0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-27 20:23:08 +00:00

Compare commits

..

32 Commits

Author SHA1 Message Date
Trevor Buckner
6cfdfad7d3 Clean up combobox component 2025-02-10 00:33:33 -05:00
Víctor Losada Hernández
213a719337 Merge pull request #4036 from G-Ambatte/correctChangeLogTypo
Correct typo in date of v3.17.0
2025-02-09 11:33:37 +01:00
G.Ambatte
a7a7e46e89 Correct typo in date of v3.17.0 2025-02-09 22:40:54 +13:00
Trevor Buckner
10fae6dbac Merge pull request #4026 from 5e-Cleric/fix-errorpage-error-if-brew-title-doesn't-exist
fix undefined value in errorIndex.js if brew doesn't exist
2025-02-03 14:24:30 -05:00
Víctor Losada Hernández
ebc7f055fa Merge branch 'master' into fix-errorpage-error-if-brew-title-doesn't-exist 2025-02-03 15:26:36 +01:00
Víctor Losada Hernández
ce01b6c1ff initial commit 2025-02-03 15:10:34 +01:00
Trevor Buckner
553562611f Merge pull request #4024 from naturalcrit/dependabot/npm_and_yarn/react-router-7.1.5
Bump react-router from 7.1.4 to 7.1.5
2025-02-03 00:07:11 -05:00
dependabot[bot]
423caefe1a Bump react-router from 7.1.4 to 7.1.5
Bumps [react-router](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router) from 7.1.4 to 7.1.5.
- [Release notes](https://github.com/remix-run/react-router/releases)
- [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router/CHANGELOG.md)
- [Commits](https://github.com/remix-run/react-router/commits/react-router@7.1.5/packages/react-router)

---
updated-dependencies:
- dependency-name: react-router
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-03 04:45:39 +00:00
Trevor Buckner
ae1de819ea Merge pull request #4025 from naturalcrit/dependabot/npm_and_yarn/mongoose-8.9.6
Bump mongoose from 8.9.5 to 8.9.6
2025-02-02 23:44:17 -05:00
dependabot[bot]
27c4cfd25c Bump mongoose from 8.9.5 to 8.9.6
Bumps [mongoose](https://github.com/Automattic/mongoose) from 8.9.5 to 8.9.6.
- [Release notes](https://github.com/Automattic/mongoose/releases)
- [Changelog](https://github.com/Automattic/mongoose/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Automattic/mongoose/compare/8.9.5...8.9.6)

---
updated-dependencies:
- dependency-name: mongoose
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-03 03:16:41 +00:00
Trevor Buckner
6c8b94453e Merge pull request #4019 from naturalcrit/update-notif-to-handle-markdown
upadte notification popup to handle markdown
2025-01-31 14:31:31 -05:00
Víctor Losada Hernández
460fb655d8 bring margin back 2025-01-31 20:11:57 +01:00
Víctor Losada Hernández
be1742d01d remove unnecessary spaces 2025-01-31 20:08:10 +01:00
Víctor Losada Hernández
5d3742aea6 Merge branch 'update-notif-to-handle-markdown' of https://github.com/naturalcrit/homebrewery into update-notif-to-handle-markdown 2025-01-31 20:02:33 +01:00
Víctor Losada Hernández
1966027289 linting & suggested changes 2025-01-31 20:02:31 +01:00
Víctor Losada Hernández
35d50cc9d1 Merge branch 'master' of https://github.com/naturalcrit/homebrewery into update-notif-to-handle-markdown 2025-01-31 20:01:29 +01:00
Trevor Buckner
3f41306306 Merge branch 'master' into update-notif-to-handle-markdown 2025-01-31 13:43:50 -05:00
Trevor Buckner
988bf1b0a9 Merge pull request #4020 from naturalcrit/FixStyleLintImport
Fix StyleLint require to import
2025-01-31 13:42:19 -05:00
Trevor Buckner
2f1ade8463 lint 2025-01-31 13:38:25 -05:00
Trevor Buckner
518924d725 Use import, run eslint 2025-01-31 13:36:42 -05:00
Trevor Buckner
6269651c8d Update Marked to v13.0.3 2025-01-31 12:42:54 -05:00
Víctor Losada Hernández
057abcda0d reduce style between li elements 2025-01-31 12:04:40 +01:00
Víctor Losada Hernández
b6b23a787c upadte notification popup to handle markdown 2025-01-31 11:52:46 +01:00
Trevor Buckner
899004cfaf Merge pull request #4017 from naturalcrit/dependabot/npm_and_yarn/react-router-7.1.4
Bump react-router from 7.1.3 to 7.1.4
2025-01-31 00:35:03 -05:00
dependabot[bot]
7e826cd4f5 Bump react-router from 7.1.3 to 7.1.4
Bumps [react-router](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router) from 7.1.3 to 7.1.4.
- [Release notes](https://github.com/remix-run/react-router/releases)
- [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router/CHANGELOG.md)
- [Commits](https://github.com/remix-run/react-router/commits/react-router@7.1.4/packages/react-router)

---
updated-dependencies:
- dependency-name: react-router
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-31 05:22:30 +00:00
Trevor Buckner
3b150891bc Merge pull request #4016 from naturalcrit/dependabot/npm_and_yarn/dompurify-3.2.4
Bump dompurify from 3.2.3 to 3.2.4
2025-01-31 00:21:09 -05:00
dependabot[bot]
e87acc3f0f Bump dompurify from 3.2.3 to 3.2.4
Bumps [dompurify](https://github.com/cure53/DOMPurify) from 3.2.3 to 3.2.4.
- [Release notes](https://github.com/cure53/DOMPurify/releases)
- [Commits](https://github.com/cure53/DOMPurify/compare/3.2.3...3.2.4)

---
updated-dependencies:
- dependency-name: dompurify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-31 05:17:57 +00:00
Trevor Buckner
b1e99f1385 Marked 12.0.2 2025-01-31 00:16:37 -05:00
Trevor Buckner
4e0b6d634d Marked 12.0.1 2025-01-31 00:12:13 -05:00
Trevor Buckner
a72f0f2f34 Merge pull request #4018 from naturalcrit/up-Marked-to-v12
Update Marked.js to v12.0.0
2025-01-31 00:08:01 -05:00
Trevor Buckner
23944f4fe0 smartypants package updated to support higher Marked versions
Next Marked versions break things; need to update incrementally
2025-01-31 00:03:44 -05:00
Trevor Buckner
c244199190 Merge pull request #4015 from naturalcrit/v3.17
Update to v3.17.0
2025-01-30 22:38:26 -05:00
13 changed files with 234 additions and 206 deletions

View File

@@ -88,7 +88,7 @@ pre {
## changelog ## changelog
For a full record of development, visit our [Github Page](https://github.com/naturalcrit/homebrewery). For a full record of development, visit our [Github Page](https://github.com/naturalcrit/homebrewery).
### Thursday 01/30/2024 - v3.17.0 ### Thursday 01/30/2025 - v3.17.0
{{taskList {{taskList
##### 5e-Cleric ##### 5e-Cleric

View File

@@ -58,10 +58,10 @@ const Combobox = createClass({
this.props.onEntry(e); this.props.onEntry(e);
}); });
}, },
handleSelect : function(e){ handleSelect : function(value, data=value){
this.setState({ this.setState({
value : e.currentTarget.getAttribute('data-value') value : value
}, ()=>{this.props.onSelect(this.state.value);}); }, ()=>{this.props.onSelect(data);});
; ;
}, },
renderTextInput : function(){ renderTextInput : function(){
@@ -82,6 +82,7 @@ const Combobox = createClass({
} }
}} }}
/> />
<i className='fas fa-caret-down'/>
</div> </div>
); );
}, },
@@ -92,11 +93,10 @@ const Combobox = createClass({
const filterOn = _.isString(this.props.autoSuggest.filterOn) ? [this.props.autoSuggest.filterOn] : this.props.autoSuggest.filterOn; const filterOn = _.isString(this.props.autoSuggest.filterOn) ? [this.props.autoSuggest.filterOn] : this.props.autoSuggest.filterOn;
const filteredArrays = filterOn.map((attr)=>{ const filteredArrays = filterOn.map((attr)=>{
const children = dropdownChildren.filter((item)=>{ const children = dropdownChildren.filter((item)=>{
if(suggestMethod === 'includes'){ if(suggestMethod === 'includes')
return item.props[attr]?.toLowerCase().includes(this.state.value.toLowerCase()); return item.props[attr]?.toLowerCase().includes(this.state.value.toLowerCase());
} else if(suggestMethod === 'startsWith'){ if(suggestMethod === 'startsWith')
return item.props[attr]?.toLowerCase().startsWith(this.state.value.toLowerCase()); return item.props[attr]?.toLowerCase().startsWith(this.state.value.toLowerCase());
}
}); });
return children; return children;
}); });
@@ -111,7 +111,7 @@ const Combobox = createClass({
}, },
render : function () { render : function () {
const dropdownChildren = this.state.options.map((child, i)=>{ const dropdownChildren = this.state.options.map((child, i)=>{
const clone = React.cloneElement(child, { onClick: (e)=>this.handleSelect(e) }); const clone = React.cloneElement(child, { onClick: ()=>this.handleSelect(child.props.value, child.props.data) });
return clone; return clone;
}); });
return ( return (

View File

@@ -1,50 +1,46 @@
.dropdown-container { .dropdown-container {
position : relative; position : relative;
input { input { width : 100%; }
width: 100%; .item i {
position : absolute;
right : 10px;
color : black;
} }
.dropdown-options { .dropdown-options {
position : absolute; position : absolute;
background-color: white;
z-index : 100; z-index : 100;
width : 100%; width : 100%;
border: 1px solid gray;
overflow-y: auto;
max-height : 200px; max-height : 200px;
overflow-y : auto;
background-color : white;
border : 1px solid gray;
&::-webkit-scrollbar { &::-webkit-scrollbar { width : 14px; }
width: 14px; &::-webkit-scrollbar-track { background : #FFFFFF; }
}
&::-webkit-scrollbar-track {
background: #ffffff;
}
&::-webkit-scrollbar-thumb { &::-webkit-scrollbar-thumb {
background-color : #949494; background-color : #949494;
border : 3px solid #FFFFFF;
border-radius : 10px; border-radius : 10px;
border: 3px solid #ffffff;
} }
.item { .item {
position : relative; position : relative;
font-size: 11px;
font-family: Open Sans;
padding : 5px; padding : 5px;
cursor: default;
margin : 0 3px; margin : 0 3px;
//border-bottom: 1px solid darkgray; font-family : "Open Sans";
font-size : 11px;
cursor : default;
&:hover { &:hover {
filter: brightness(120%);
background-color : rgb(163, 163, 163); background-color : rgb(163, 163, 163);
filter : brightness(120%);
} }
.detail { .detail {
width : 100%; width : 100%;
text-align: left;
color: rgb(124, 124, 124);
font-style:italic;
font-size : 9px; font-size : 9px;
font-style : italic;
color : rgb(124, 124, 124);
text-align : left;
} }
} }
} }
} }

View File

@@ -1,6 +1,7 @@
require('./notificationPopup.less'); require('./notificationPopup.less');
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import request from '../../utils/request-middleware.js'; import request from '../../utils/request-middleware.js';
import Markdown from 'naturalcrit/markdown.js';
import Dialog from '../../../components/dialog.jsx'; import Dialog from '../../../components/dialog.jsx';
@@ -40,11 +41,10 @@ const NotificationPopup = ()=>{
const renderNotificationsList = ()=>{ const renderNotificationsList = ()=>{
if(error) return <div className='error'>{error}</div>; if(error) return <div className='error'>{error}</div>;
return notifications.map((notification)=>( return notifications.map((notification)=>(
<li key={notification.dismissKey} > <li key={notification.dismissKey} >
<em>{notification.title}</em><br /> <em>{notification.title}</em><br />
<p dangerouslySetInnerHTML={{ __html: notification.text }}></p> <p dangerouslySetInnerHTML={{ __html: Markdown.render(notification.text) }}></p>
</li> </li>
)); ));
}; };

View File

@@ -48,17 +48,46 @@
} }
ul { ul {
margin-top : 15px; margin-top : 15px;
font-size : 0.8em; font-size : 0.9em;
list-style-position : outside; list-style-position : outside;
list-style-type : disc; list-style-type : disc;
li { li {
margin-top : 1.4em; padding-left : 1em;
font-size : 0.8em; margin-top : 1.5em;
line-height : 1.4em; font-size : 0.9em;
line-height : 1.5em;
em { em {
text-transform:capitalize;
font-weight : 800; font-weight : 800;
text-transform : capitalize;
}
li {
margin-top : 0;
line-height : 1.2em;
list-style-type : square;
} }
} }
ul ul,ol ol,ul ol,ol ul {
margin-bottom : 0px;
margin-left : 1.5em;
}
}
/* Markdown styling */
code {
padding : 0.1em 0.5em;
font-family : 'Courier New', 'Courier', monospace;
overflow-wrap : break-word;
white-space : pre-wrap;
background : #08115A;
border-radius : 2px;
}
pre code {
display : inline-block;
width : 100%;
}
.blank {
height : 1em;
margin-top : 0;
& + * { margin-top : 0; }
} }
} }

View File

@@ -244,9 +244,9 @@ const MetadataEditor = createClass({
return _.map(langCodes.sort(), (code, index)=>{ return _.map(langCodes.sort(), (code, index)=>{
const localName = new Intl.DisplayNames([code], { type: 'language' }); const localName = new Intl.DisplayNames([code], { type: 'language' });
const englishName = new Intl.DisplayNames('en', { type: 'language' }); const englishName = new Intl.DisplayNames('en', { type: 'language' });
return <div className='item' title={`${englishName.of(code)}`} key={`${index}`} data-value={`${code}`} data-detail={`${localName.of(code)}`}> return <div className='item' title={englishName.of(code)} key={`${index}`} value={code} detail={localName.of(code)}>
{`${code}`} {code}
<div className='detail'>{`${localName.of(code)}`}</div> <div className='detail'>{localName.of(code)}</div>
</div>; </div>;
}); });
}; };
@@ -269,7 +269,7 @@ const MetadataEditor = createClass({
autoSuggest={{ autoSuggest={{
suggestMethod : 'startsWith', suggestMethod : 'startsWith',
clearAutoSuggestOnClick : true, clearAutoSuggestOnClick : true,
filterOn : ['data-value', 'data-detail', 'title'] filterOn : ['value', 'detail', 'title']
}} }}
> >
</Combobox> </Combobox>

View File

@@ -3,8 +3,8 @@ const dedent = require('dedent-tabs').default;
const loginUrl = 'https://www.naturalcrit.com/login'; const loginUrl = 'https://www.naturalcrit.com/login';
// Prevent parsing text (e.g. document titles) as markdown // Prevent parsing text (e.g. document titles) as markdown
const escape = (text) => { const escape = (text = '')=>{
return text.split('').map(char => `&#${char.charCodeAt(0)};`).join(''); return text.split('').map((char)=>`&#${char.charCodeAt(0)};`).join('');
}; };
//001-050 : Brew errors //001-050 : Brew errors

55
package-lock.json generated
View File

@@ -23,7 +23,7 @@
"cors": "^2.8.5", "cors": "^2.8.5",
"create-react-class": "^15.7.0", "create-react-class": "^15.7.0",
"dedent-tabs": "^0.10.3", "dedent-tabs": "^0.10.3",
"dompurify": "^3.2.3", "dompurify": "^3.2.4",
"expr-eval": "^2.0.2", "expr-eval": "^2.0.2",
"express": "^4.21.2", "express": "^4.21.2",
"express-async-handler": "^1.2.0", "express-async-handler": "^1.2.0",
@@ -34,20 +34,20 @@
"jwt-simple": "^0.5.6", "jwt-simple": "^0.5.6",
"less": "^3.13.1", "less": "^3.13.1",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"marked": "11.2.0", "marked": "13.0.3",
"marked-emoji": "^1.4.3", "marked-emoji": "^1.4.3",
"marked-extended-tables": "^1.1.0", "marked-extended-tables": "^1.1.0",
"marked-gfm-heading-id": "^3.2.0", "marked-gfm-heading-id": "^4.0.1",
"marked-smartypants-lite": "^1.0.2", "marked-smartypants-lite": "^1.0.3",
"markedLegacy": "npm:marked@^0.3.19", "markedLegacy": "npm:marked@^0.3.19",
"moment": "^2.30.1", "moment": "^2.30.1",
"mongoose": "^8.9.5", "mongoose": "^8.9.6",
"nanoid": "5.0.9", "nanoid": "5.0.9",
"nconf": "^0.12.1", "nconf": "^0.12.1",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-frame-component": "^4.1.3", "react-frame-component": "^4.1.3",
"react-router": "^7.1.3", "react-router": "^7.1.5",
"sanitize-filename": "1.6.3", "sanitize-filename": "1.6.3",
"superagent": "^10.1.1", "superagent": "^10.1.1",
"vitreum": "git+https://git@github.com/calculuschild/vitreum.git" "vitreum": "git+https://git@github.com/calculuschild/vitreum.git"
@@ -5313,9 +5313,10 @@
} }
}, },
"node_modules/dompurify": { "node_modules/dompurify": {
"version": "3.2.3", "version": "3.2.4",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.3.tgz", "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.4.tgz",
"integrity": "sha512-U1U5Hzc2MO0oW3DF+G9qYN0aT7atAou4AgI0XjWz061nyBPbdxkfdhfy5uMgGn6+oLFCfn44ZGbdDqCzVmlOWA==", "integrity": "sha512-ysFSFEDVduQpyhzAob/kkuJjf5zWkZD8/A9ywSp1byueyuCfHamrCBa14/Oc2iiB0e51B+NpxSl5gmzn+Ms/mg==",
"license": "(MPL-2.0 OR Apache-2.0)",
"optionalDependencies": { "optionalDependencies": {
"@types/trusted-types": "^2.0.7" "@types/trusted-types": "^2.0.7"
} }
@@ -9788,9 +9789,9 @@
} }
}, },
"node_modules/marked": { "node_modules/marked": {
"version": "11.2.0", "version": "13.0.3",
"resolved": "https://registry.npmjs.org/marked/-/marked-11.2.0.tgz", "resolved": "https://registry.npmjs.org/marked/-/marked-13.0.3.tgz",
"integrity": "sha512-HR0m3bvu0jAPYiIvLUUQtdg1g6D247//lvcekpHO1WMvbwDlwSkZAX9Lw4F4YHE1T0HaaNve0tuAWuV1UJ6vtw==", "integrity": "sha512-rqRix3/TWzE9rIoFGIn8JmsVfhiuC8VIQ8IdX5TfzmeBucdY05/0UlzKaw0eVtpcN/OdVFpBk7CjKGo9iHJ/zA==",
"license": "MIT", "license": "MIT",
"bin": { "bin": {
"marked": "bin/marked.js" "marked": "bin/marked.js"
@@ -9816,24 +9817,24 @@
} }
}, },
"node_modules/marked-gfm-heading-id": { "node_modules/marked-gfm-heading-id": {
"version": "3.2.0", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/marked-gfm-heading-id/-/marked-gfm-heading-id-3.2.0.tgz", "resolved": "https://registry.npmjs.org/marked-gfm-heading-id/-/marked-gfm-heading-id-4.1.1.tgz",
"integrity": "sha512-Xfxpr5lXLDLY10XqzSCA9l2dDaiabQUgtYM9hw8yunyVsB/xYBRpiic6BOiY/EAJw1ik1eWr1ET1HKOAPZBhXg==", "integrity": "sha512-EeQZieAQmsI6c2tWLx0ETd0VjPwLV8qi+HT0dIsfVMERm0rCIuXfRvZXJbo1SgUi++lmuR1LVY+QzgNiLNvVpw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"github-slugger": "^2.0.0" "github-slugger": "^2.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"marked": ">=4 <13" "marked": ">=13 <16"
} }
}, },
"node_modules/marked-smartypants-lite": { "node_modules/marked-smartypants-lite": {
"version": "1.0.2", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/marked-smartypants-lite/-/marked-smartypants-lite-1.0.2.tgz", "resolved": "https://registry.npmjs.org/marked-smartypants-lite/-/marked-smartypants-lite-1.0.3.tgz",
"integrity": "sha512-cEANts+s3+gnTzXPvPT2z4V8NfbMEL9QooKUviug0DkaKkXQWrUwDAmFnQAkLSJCw2BQcD8YPDyxu0HJ3mg36w==", "integrity": "sha512-OOL8cjFog8KtgUFpkihRu6G42Dz2QPOU4k2xfKmMJ0CdoX+BHBDmdesHUdoQKM0mlwTsRSU3shpMeM/LWuUokg==",
"license": "MIT", "license": "MIT",
"peerDependencies": { "peerDependencies": {
"marked": ">=4 <12" "marked": ">=4 <16"
} }
}, },
"node_modules/markedLegacy": { "node_modules/markedLegacy": {
@@ -10186,9 +10187,10 @@
} }
}, },
"node_modules/mongoose": { "node_modules/mongoose": {
"version": "8.9.5", "version": "8.9.6",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.9.5.tgz", "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.9.6.tgz",
"integrity": "sha512-SPhOrgBm0nKV3b+IIHGqpUTOmgVL5Z3OO9AwkFEmvOZznXTvplbomstCnPOGAyungtRXE5pJTgKpKcZTdjeESg==", "integrity": "sha512-ipLvXwNPVuuuq5H3lnSD0lpaRH3DlCoC6emnMVJvweTwxU29uxDJWxMsNpERDQt8JMvYF1HGVuTK+Id2BlQLCA==",
"license": "MIT",
"dependencies": { "dependencies": {
"bson": "^6.10.1", "bson": "^6.10.1",
"kareem": "2.6.3", "kareem": "2.6.3",
@@ -11608,9 +11610,10 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/react-router": { "node_modules/react-router": {
"version": "7.1.3", "version": "7.1.5",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.1.3.tgz", "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.1.5.tgz",
"integrity": "sha512-EezYymLY6Guk/zLQ2vRA8WvdUhWFEj5fcE3RfWihhxXBW7+cd1LsIiA3lmx+KCmneAGQuyBv820o44L2+TtkSA==", "integrity": "sha512-8BUF+hZEU4/z/JD201yK6S+UYhsf58bzYIDq2NS1iGpwxSXDu7F+DeGSkIXMFBuHZB21FSiCzEcUb18cQNdRkA==",
"license": "MIT",
"dependencies": { "dependencies": {
"@types/cookie": "^0.6.0", "@types/cookie": "^0.6.0",
"cookie": "^1.0.1", "cookie": "^1.0.1",

View File

@@ -98,7 +98,7 @@
"cors": "^2.8.5", "cors": "^2.8.5",
"create-react-class": "^15.7.0", "create-react-class": "^15.7.0",
"dedent-tabs": "^0.10.3", "dedent-tabs": "^0.10.3",
"dompurify": "^3.2.3", "dompurify": "^3.2.4",
"expr-eval": "^2.0.2", "expr-eval": "^2.0.2",
"express": "^4.21.2", "express": "^4.21.2",
"express-async-handler": "^1.2.0", "express-async-handler": "^1.2.0",
@@ -109,20 +109,20 @@
"jwt-simple": "^0.5.6", "jwt-simple": "^0.5.6",
"less": "^3.13.1", "less": "^3.13.1",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"marked": "11.2.0", "marked": "13.0.3",
"marked-emoji": "^1.4.3", "marked-emoji": "^1.4.3",
"marked-extended-tables": "^1.1.0", "marked-extended-tables": "^1.1.0",
"marked-gfm-heading-id": "^3.2.0", "marked-gfm-heading-id": "^4.0.1",
"marked-smartypants-lite": "^1.0.2", "marked-smartypants-lite": "^1.0.3",
"markedLegacy": "npm:marked@^0.3.19", "markedLegacy": "npm:marked@^0.3.19",
"moment": "^2.30.1", "moment": "^2.30.1",
"mongoose": "^8.9.5", "mongoose": "^8.9.6",
"nanoid": "5.0.9", "nanoid": "5.0.9",
"nconf": "^0.12.1", "nconf": "^0.12.1",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-frame-component": "^4.1.3", "react-frame-component": "^4.1.3",
"react-router": "^7.1.3", "react-router": "^7.1.5",
"sanitize-filename": "1.6.3", "sanitize-filename": "1.6.3",
"superagent": "^10.1.1", "superagent": "^10.1.1",
"vitreum": "git+https://git@github.com/calculuschild/vitreum.git" "vitreum": "git+https://git@github.com/calculuschild/vitreum.git"

View File

@@ -1,5 +1,5 @@
const stylelint = require('stylelint'); import stylelint from 'stylelint';
const { isNumber } = require('stylelint/lib/utils/validateTypes.cjs'); import { isNumber } from 'stylelint/lib/utils/validateTypes.mjs';
const { report, ruleMessages, validateOptions } = stylelint.utils; const { report, ruleMessages, validateOptions } = stylelint.utils;
const ruleName = 'naturalcrit/declaration-block-multi-line-min-declarations'; const ruleName = 'naturalcrit/declaration-block-multi-line-min-declarations';
@@ -7,9 +7,8 @@ const messages = ruleMessages(ruleName, {
expected : (decls)=>`Rule with ${decls} declaration${decls == 1 ? '' : 's'} should be single line`, expected : (decls)=>`Rule with ${decls} declaration${decls == 1 ? '' : 's'} should be single line`,
}); });
const ruleFunction = (primaryOption, secondaryOptionObject, context)=>{
module.exports = stylelint.createPlugin(ruleName, function getPlugin(primaryOption, secondaryOptionObject, context) { return (postcssRoot, postcssResult)=>{
return function lint(postcssRoot, postcssResult) {
const validOptions = validateOptions( const validOptions = validateOptions(
postcssResult, postcssResult,
@@ -20,26 +19,23 @@ module.exports = stylelint.createPlugin(ruleName, function getPlugin(primaryOpti
} }
); );
if(!validOptions) { //If the options are invalid, don't lint if(!validOptions) //If the options are invalid, don't lint
return; return;
}
const isAutoFixing = Boolean(context.fix); const isAutoFixing = Boolean(context.fix);
postcssRoot.walkRules((rule)=>{ //Iterate CSS rules postcssRoot.walkRules((rule)=>{ //Iterate CSS rules
//Apply rule only if all children are decls (no further nested rules) //Apply rule only if all children are decls (no further nested rules)
if(rule.nodes.length > primaryOption || !rule.nodes.every((node)=>node.type === 'decl')) { if(rule.nodes.length > primaryOption || !rule.nodes.every((node)=>node.type === 'decl'))
return; return;
}
//Ignore if already one line //Ignore if already one line
if(!rule.nodes.some((node)=>node.raws.before.includes('\n')) && !rule.raws.after.includes('\n')) if(!rule.nodes.some((node)=>node.raws.before.includes('\n')) && !rule.raws.after.includes('\n'))
return; return;
if(isAutoFixing) { //We are in “fix” mode if(isAutoFixing) { //We are in “fix” mode
rule.each((decl)=>{ rule.each((decl)=>decl.raws.before = ' ');
decl.raws.before = ' ';
});
rule.raws.after = ' '; rule.raws.after = ' ';
} else { } else {
report({ report({
@@ -52,7 +48,9 @@ module.exports = stylelint.createPlugin(ruleName, function getPlugin(primaryOpti
} }
}); });
}; };
}); };
module.exports.ruleName = ruleName; ruleFunction.ruleName = ruleName;
module.exports.messages = messages; ruleFunction.messages = messages;
export default stylelint.createPlugin(ruleName, ruleFunction);

View File

@@ -1,31 +1,28 @@
const stylelint = require('stylelint'); import stylelint from 'stylelint';
const { report, ruleMessages, validateOptions } = stylelint.utils; const { report, ruleMessages, validateOptions } = stylelint.utils;
const ruleName = 'naturalcrit/declaration-colon-align'; const ruleName = 'naturalcrit/declaration-colon-align';
const messages = ruleMessages(ruleName, { const messages = ruleMessages(ruleName, {
expected : (rule)=>`Expected colons aligned within rule "${rule}"`, expected : (rule)=>`Expected colons aligned within rule "${rule}"`,
}); });
const ruleFunction = (primaryOption, secondaryOptionObject, context)=>{
module.exports = stylelint.createPlugin(ruleName, function getPlugin(primaryOption, secondaryOptionObject, context) { return (postcssRoot, postcssResult)=>{
return function lint(postcssRoot, postcssResult) {
const validOptions = validateOptions( const validOptions = validateOptions(
postcssResult, postcssResult,
ruleName, ruleName,
{ {
actual : primaryOption, actual : primaryOption,
possible : [ possible : [true, false]
true,
false
]
} }
); );
if(!validOptions) { //If the options are invalid, don't lint if(!validOptions) // If the options are invalid, don't lint
return; return;
}
const isAutoFixing = Boolean(context.fix); const isAutoFixing = Boolean(context.fix);
postcssRoot.walkRules((rule)=>{ // Iterate CSS rules postcssRoot.walkRules((rule)=>{ // Iterate CSS rules
let maxColonPos = 0; let maxColonPos = 0;
@@ -36,13 +33,16 @@ module.exports = stylelint.createPlugin(ruleName, function getPlugin(primaryOpti
return; return;
const colonPos = declaration.prop.length + declaration.raws.between.indexOf(':'); const colonPos = declaration.prop.length + declaration.raws.between.indexOf(':');
if(maxColonPos > 0 && colonPos != maxColonPos) {
if(maxColonPos > 0 && colonPos != maxColonPos)
misaligned = true; misaligned = true;
}
maxColonPos = Math.max(maxColonPos, colonPos); maxColonPos = Math.max(maxColonPos, colonPos);
}); });
if(misaligned) { if(!misaligned)
return;
if(isAutoFixing) { // We are in “fix” mode if(isAutoFixing) { // We are in “fix” mode
rule.each((declaration)=>{ rule.each((declaration)=>{
if(declaration.type != 'decl') if(declaration.type != 'decl')
@@ -59,10 +59,11 @@ module.exports = stylelint.createPlugin(ruleName, function getPlugin(primaryOpti
word : rule.selector, // Which exact word caused the error? This positions the error properly word : rule.selector, // Which exact word caused the error? This positions the error properly
}); });
} }
}
}); });
}; };
}); };
module.exports.ruleName = ruleName; ruleFunction.ruleName = ruleName;
module.exports.messages = messages; ruleFunction.messages = messages;
export default stylelint.createPlugin(ruleName, ruleFunction);

View File

@@ -1,5 +1,5 @@
const stylelint = require('stylelint'); import stylelint from 'stylelint';
const { isNumber } = require('stylelint/lib/utils/validateTypes.cjs'); import { isNumber } from 'stylelint/lib/utils/validateTypes.mjs';
const { report, ruleMessages, validateOptions } = stylelint.utils; const { report, ruleMessages, validateOptions } = stylelint.utils;
const ruleName = 'naturalcrit/declaration-colon-min-space-before'; const ruleName = 'naturalcrit/declaration-colon-min-space-before';
@@ -7,9 +7,8 @@ const messages = ruleMessages(ruleName, {
expected : (num)=>`Expected at least ${num} space${num == 1 ? '' : 's'} before ":"` expected : (num)=>`Expected at least ${num} space${num == 1 ? '' : 's'} before ":"`
}); });
const ruleFunction = (primaryOption, secondaryOptionObject, context)=>{
module.exports = stylelint.createPlugin(ruleName, function getPlugin(primaryOption, secondaryOptionObject, context) { return (postcssRoot, postcssResult)=>{
return function lint(postcssRoot, postcssResult) {
const validOptions = validateOptions( const validOptions = validateOptions(
postcssResult, postcssResult,
@@ -30,9 +29,9 @@ module.exports = stylelint.createPlugin(ruleName, function getPlugin(primaryOpti
const between = decl.raws.between; const between = decl.raws.between;
const colonIndex = between.indexOf(':'); const colonIndex = between.indexOf(':');
if(between.slice(0, colonIndex).length >= primaryOption) { if(between.slice(0, colonIndex).length >= primaryOption)
return; return;
}
if(isAutoFixing) { //We are in “fix” mode if(isAutoFixing) { //We are in “fix” mode
decl.raws.between = between.slice(0, colonIndex).replace(/\s*$/, ' '.repeat(primaryOption)) + between.slice(colonIndex); decl.raws.between = between.slice(0, colonIndex).replace(/\s*$/, ' '.repeat(primaryOption)) + between.slice(colonIndex);
} else { } else {
@@ -46,7 +45,9 @@ module.exports = stylelint.createPlugin(ruleName, function getPlugin(primaryOpti
} }
}); });
}; };
}); };
module.exports.ruleName = ruleName; ruleFunction.ruleName = ruleName;
module.exports.messages = messages; ruleFunction.messages = messages;
export default stylelint.createPlugin(ruleName, ruleFunction);