diff --git a/core-server/utils/escapecss.js b/core-server/utils/escapecss.js new file mode 100644 index 000000000..8a30c0746 --- /dev/null +++ b/core-server/utils/escapecss.js @@ -0,0 +1,95 @@ +/*\ +title: $:/core-server/modules/utils/escapecss.js +type: application/javascript +module-type: utils-node + +Provides CSS.escape() functionality. + +\*/ + +"use strict"; + +exports.escapeCSS = (function() { + // see also https://drafts.csswg.org/cssom/#serialize-an-identifier + + /* eslint-disable */ + /*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */ + return function(value) { + if (arguments.length == 0) { + throw new TypeError('`CSS.escape` requires an argument.'); + } + var string = String(value); + var length = string.length; + var index = -1; + var codeUnit; + var result = ''; + var firstCodeUnit = string.charCodeAt(0); + while (++index < length) { + codeUnit = string.charCodeAt(index); + // Note: there’s no need to special-case astral symbols, surrogate + // pairs, or lone surrogates. + + // If the character is NULL (U+0000), then the REPLACEMENT CHARACTER + // (U+FFFD). + if (codeUnit == 0x0000) { + result += '\uFFFD'; + continue; + } + + if ( + // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is + // U+007F, […] + (codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F || + // If the character is the first character and is in the range [0-9] + // (U+0030 to U+0039), […] + (index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) || + // If the character is the second character and is in the range [0-9] + // (U+0030 to U+0039) and the first character is a `-` (U+002D), […] + ( + index == 1 && + codeUnit >= 0x0030 && codeUnit <= 0x0039 && + firstCodeUnit == 0x002D + ) + ) { + // https://drafts.csswg.org/cssom/#escape-a-character-as-code-point + result += '\\' + codeUnit.toString(16) + ' '; + continue; + } + + if ( + // If the character is the first character and is a `-` (U+002D), and + // there is no second character, […] + index == 0 && + length == 1 && + codeUnit == 0x002D + ) { + result += '\\' + string.charAt(index); + continue; + } + + // If the character is not handled by one of the above rules and is + // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or + // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to + // U+005A), or [a-z] (U+0061 to U+007A), […] + if ( + codeUnit >= 0x0080 || + codeUnit == 0x002D || + codeUnit == 0x005F || + codeUnit >= 0x0030 && codeUnit <= 0x0039 || + codeUnit >= 0x0041 && codeUnit <= 0x005A || + codeUnit >= 0x0061 && codeUnit <= 0x007A + ) { + // the character itself + result += string.charAt(index); + continue; + } + + // Otherwise, the escaped character. + // https://drafts.csswg.org/cssom/#escape-a-character + result += '\\' + string.charAt(index); + + } + return result; + }; + /* eslint-enable */ +})(); diff --git a/core/modules/utils/escapecss.js b/core/modules/utils/escapecss.js index f2248c445..0df27da7b 100644 --- a/core/modules/utils/escapecss.js +++ b/core/modules/utils/escapecss.js @@ -1,7 +1,7 @@ /*\ title: $:/core/modules/utils/escapecss.js type: application/javascript -module-type: utils +module-type: utils-browser Provides CSS.escape() functionality. @@ -9,92 +9,6 @@ Provides CSS.escape() functionality. "use strict"; -// TODO -- resolve this construction exports.escapeCSS = (function() { - // use browser's native CSS.escape() function if available - if ($tw.browser && window.CSS && window.CSS.escape) { - return window.CSS.escape; - } - - // otherwise, a utility method is provided - // see also https://drafts.csswg.org/cssom/#serialize-an-identifier - - /*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */ - return function(value) { - if (arguments.length == 0) { - throw new TypeError('`CSS.escape` requires an argument.'); - } - var string = String(value); - var length = string.length; - var index = -1; - var codeUnit; - var result = ''; - var firstCodeUnit = string.charCodeAt(0); - while (++index < length) { - codeUnit = string.charCodeAt(index); - // Note: there’s no need to special-case astral symbols, surrogate - // pairs, or lone surrogates. - - // If the character is NULL (U+0000), then the REPLACEMENT CHARACTER - // (U+FFFD). - if (codeUnit == 0x0000) { - result += '\uFFFD'; - continue; - } - - if ( - // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is - // U+007F, […] - (codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F || - // If the character is the first character and is in the range [0-9] - // (U+0030 to U+0039), […] - (index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) || - // If the character is the second character and is in the range [0-9] - // (U+0030 to U+0039) and the first character is a `-` (U+002D), […] - ( - index == 1 && - codeUnit >= 0x0030 && codeUnit <= 0x0039 && - firstCodeUnit == 0x002D - ) - ) { - // https://drafts.csswg.org/cssom/#escape-a-character-as-code-point - result += '\\' + codeUnit.toString(16) + ' '; - continue; - } - - if ( - // If the character is the first character and is a `-` (U+002D), and - // there is no second character, […] - index == 0 && - length == 1 && - codeUnit == 0x002D - ) { - result += '\\' + string.charAt(index); - continue; - } - - // If the character is not handled by one of the above rules and is - // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or - // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to - // U+005A), or [a-z] (U+0061 to U+007A), […] - if ( - codeUnit >= 0x0080 || - codeUnit == 0x002D || - codeUnit == 0x005F || - codeUnit >= 0x0030 && codeUnit <= 0x0039 || - codeUnit >= 0x0041 && codeUnit <= 0x005A || - codeUnit >= 0x0061 && codeUnit <= 0x007A - ) { - // the character itself - result += string.charAt(index); - continue; - } - - // Otherwise, the escaped character. - // https://drafts.csswg.org/cssom/#escape-a-character - result += '\\' + string.charAt(index); - - } - return result; - }; + return window.CSS.escape; })(); diff --git a/core/modules/widgets/let.js b/core/modules/widgets/let.js index b09c67e91..6ede8b1dd 100644 --- a/core/modules/widgets/let.js +++ b/core/modules/widgets/let.js @@ -7,7 +7,6 @@ This widget allows defining multiple variables at once, while allowing the later variables to depend upon the earlier ones. ``` -\define helloworld() Hello world! <$let currentTiddler="target" value={{!!value}} currentTiddler="different"> {{!!value}} will be different from <> @@ -56,7 +55,7 @@ LetWidget.prototype.computeAttributes = function() { }); // Run through again, setting variables and looking for differences $tw.utils.each(this.currentValueFor,function(value,name) { - if(!$tw.utils.isArrayEqual(self.attributes[name],value)) { + if(self.attributes[name] === undefined || !$tw.utils.isArrayEqual(self.attributes[name],value)) { self.attributes[name] = value; self.setVariable(name,value); changedAttributes[name] = true; @@ -68,7 +67,7 @@ LetWidget.prototype.computeAttributes = function() { LetWidget.prototype.getVariableInfo = function(name,options) { // Special handling: If this variable exists in this very $let, we can // use it, but only if it's been staged. - if ($tw.utils.hop(this.currentValueFor,name)) { + if($tw.utils.hop(this.currentValueFor,name)) { var value = this.currentValueFor[name]; return { text: value[0] || "", diff --git a/core/ui/SideBar/Open.tid b/core/ui/SideBar/Open.tid index d3e528148..b64778f47 100644 --- a/core/ui/SideBar/Open.tid +++ b/core/ui/SideBar/Open.tid @@ -15,7 +15,7 @@ caption: {{$:/language/SideBar/Open/Caption}} \define droppable-item(button) \whitespace trim -<$droppable actions=<> enable=<> tag="div"> +<$droppable actions=<> enable=<> tag="div"> <>
$button$ diff --git a/core/wiki/macros/list.tid b/core/wiki/macros/list.tid index d61390099..292cef989 100644 --- a/core/wiki/macros/list.tid +++ b/core/wiki/macros/list.tid @@ -92,7 +92,7 @@ tags: $:/tags/Macro \end -\define list-tagged-draggable(tag,subFilter,emptyMessage,itemTemplate,elementTag:"div",storyview:"",displayField:"caption") +\define list-tagged-draggable(tag,subFilter,emptyMessage,itemTemplate,elementTag:"div",storyview:"",displayField:"title") \whitespace trim <$set name="tag" value=<<__tag__>>> @@ -115,7 +115,6 @@ tags: $:/tags/Macro <$view field="title"/> - <$view field="title"/> diff --git a/core/wiki/macros/tag-picker.tid b/core/wiki/macros/tag-picker.tid index 881f88b41..34b196f98 100644 --- a/core/wiki/macros/tag-picker.tid +++ b/core/wiki/macros/tag-picker.tid @@ -21,7 +21,7 @@ second-search-filter: [subfilteris[system]search:title \procedure delete-tag-state-tiddlers() <$action-deletetiddler $filter="[] [] []"/> @@ -111,6 +111,7 @@ The second ESC tries to close the "draft tiddler" refreshTitle=<> selectionStateTitle=<> inputAcceptActions=<> + inputAcceptVariantActions=<> inputCancelActions=<> tag="input" placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}} diff --git a/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9206.tid b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9206.tid new file mode 100644 index 000000000..23dce7a72 --- /dev/null +++ b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9206.tid @@ -0,0 +1,17 @@ +change-category: nodejs +change-type: feature +created: 20260120154012282 +description: Allows server routes to be prioritized via ordering. +github-contributors: saqimtiaz +github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9206 +modified: 20260120160656948 +release: 5.4.0 +tags: $:/tags/ChangeNote +title: $:/changenotes/5.4.0/#9206 +type: text/vnd.tiddlywiki + +This PR adds support for an info property to server route module exports. The info object may include a priority field, which determines the route’s order of precedence. + +Priorities are numeric and follow a descending order: routes with higher priority values are processed first, similar to how saver modules are prioritized. + +To maintain backward compatibility with existing code, any module that omits info or info.priority is assigned a default priority of 100. Core server routes have been updated to explicitly use this default value of 100. \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9207.tid b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9207.tid new file mode 100644 index 000000000..572ca1eef --- /dev/null +++ b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9207.tid @@ -0,0 +1,13 @@ +change-category: nodejs +change-type: feature +created: 20260120154249928 +description: Allows server routes to support multiple HTTP methods. +github-contributors: saqimtiaz +github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9207 +modified: 20260120160159661 +release: 5.4.0 +tags: $:/tags/ChangeNote +title: $:/changenotes/5.4.0/#9207 +type: text/vnd.tiddlywiki + +Allows server routes to support multiple HTTP methods by introducing an `exports.methods` array. \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9259.tid b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9259.tid new file mode 100644 index 000000000..1460a60d2 --- /dev/null +++ b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9259.tid @@ -0,0 +1,13 @@ +change-category: widget +change-type: deprecation +created: 20260120154533983 +description: The deprecated events and actions-* atrributes for the eventcatcher widget have been removed. +github-contributors: saqimtiaz +github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9259 +modified: 20260120160236297 +release: 5.4.0 +tags: $:/tags/ChangeNote +title: $:/changenotes/5.4.0/#9259 +type: text/vnd.tiddlywiki + +Deprecates and removes the `events` and `actions-*` attributes for the $eventcatcher widget. \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9259_impacts_deprecate-eventcatcher-attributes.tid b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9259_impacts_deprecate-eventcatcher-attributes.tid new file mode 100644 index 000000000..38ebe64cf --- /dev/null +++ b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9259_impacts_deprecate-eventcatcher-attributes.tid @@ -0,0 +1,8 @@ +changenote: $:/changenotes/5.4.0/#9259 +created: 20260120154817011 +description: Deprecated events and actons-* attributes from the eventcatcher widget +impact-type: deprecation +modified: 20260120154900978 +tags: $:/tags/ImpactNote +title: $:/changenotes/5.4.0/#9259/impacts/deprecate-eventcatcher-attributes +type: text/vnd.tiddlywiki \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9260.tid b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9260.tid new file mode 100644 index 000000000..ffc444ca6 --- /dev/null +++ b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9260.tid @@ -0,0 +1,29 @@ +change-category: hackability +change-type: feature +created: 20260120154445701 +description: Adds info tiddlers for viewport dimensions that are updated on window resize. +github-contributors: saqimtiaz +github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9260 +modified: 20260120160515462 +release: 5.4.0 +tags: $:/tags/ChangeNote +title: $:/changenotes/5.4.0/#9260 +type: text/vnd.tiddlywiki + +Adds info tiddlers for viewport dimensions that are updated on window resize. + +!! Example: Main and a user-created window with windowID my-window + +|Window | Info tiddler | Meaning |h +|system/main |`$:/info/browser/window/system/main/outer/width` | Full browser window including chrome, tabs, toolbars | +|system/main |`$:/info/browser/window/system/main/outer/height` | Full browser window including chrome, tabs, toolbars | +|system/main |`$:/info/browser/window/system/main/inner/width` | Viewport width including scrollbars | +|system/main |`$:/info/browser/window/system/main/inner/height` | Viewport height including scrollbars | +|system/main |`$:/info/browser/window/system/main/client/width` | Content width excluding scrollbars | +|system/main |`$:/info/browser/window/system/main/client/height` | Content height excluding scrollbars | +|user/my-window |`$:/info/browser/window/user/my-window/outer/width` | Full browser window including chrome, tabs, toolbars | +|user/my-window |`$:/info/browser/window/user/my-window/outer/height` | Full browser window including chrome, tabs, toolbars | +|user/my-window |`$:/info/browser/window/user/my-window/inner/width` | Viewport width including scrollbars | +|user/my-window |`$:/info/browser/window/user/my-window/inner/height` | Viewport height including scrollbars | +|user/my-window |`$:/info/browser/window/user/my-window/client/width` | Content width excluding scrollbars | +|user/my-window |`$:/info/browser/window/user/my-window/client/height` | Content height excluding scrollbars | diff --git a/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9337 - math-filters .tid b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9337 - math-filters .tid index 8125a23f1..e24e54374 100644 --- a/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9337 - math-filters .tid +++ b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9337 - math-filters .tid @@ -1,17 +1,7 @@ -title: $:/changenotes/5.4.0/#9337/compatibility-break/math-filters +title: $:/changenotes/5.4.0/#9337/impacts/math-filters changenote: $:/changenotes/5.4.0/#9337 -created - 20251112152513384 -modified - 20251112152513384 +created: 20251112152513384 +modified: 20251209160312626 tags: $:/tags/ImpactNote -description: filter output with empty input changes for some math filter operators -impact-type: compatibility-break - -These math operators will now output an empty list when the input list is empty: - -* sum[] - previously returned 0 -* product[] - previously returned 1 -* maxall[] - previously returned -Infinity -* minall[] - previously returned Infinity -* average[] - previously returned NaN -* variance[] - previously returned NaN -* standard-deviation[] - previously returned NaN \ No newline at end of file +description: filter output changes for some math filter operators when input list is empty +impact-type: compatibility-break \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9375.tid b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9375.tid index d95ac608f..5d0059ed9 100644 --- a/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9375.tid +++ b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9375.tid @@ -4,7 +4,8 @@ release: 5.4.0 tags: $:/tags/ChangeNote change-type: enhancement change-category: translation -github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9375 +github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9375 https://github.com/TiddlyWiki/TiddlyWiki5/pull/9576 github-contributors: BramChen -* change camel-case hint text for chinese translations \ No newline at end of file +* change camel-case hint text for chinese translations +* add alerts ARIA message \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9494.tid b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9494.tid new file mode 100644 index 000000000..172925732 --- /dev/null +++ b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9494.tid @@ -0,0 +1,10 @@ +title: $:/changenotes/5.4.0/#9494 +description: Fix LetWidget to always set all staged variables on first render +release: 5.4.0 +tags: $:/tags/ChangeNote +change-type: bugfix +change-category: widget +github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9494 +github-contributors: yaisog + +This PR corrects a bug where the LetWidget did not set variables if their value was the empty output of a filtered transclusion. diff --git a/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9600.tid b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9600.tid new file mode 100644 index 000000000..3ec2e5daf --- /dev/null +++ b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9600.tid @@ -0,0 +1,10 @@ +title: $:/changenotes/5.4.0/#9600 +description: Fix Ctrl-Enter not working in EditTemplate tag name input +release: 5.4.0 +tags: $:/tags/ChangeNote +change-type: bugfix +change-category: internal +github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9600 +github-contributors: yaisog + +The tag name input now calls `<>` from the EditTemplate when Ctrl-Enter (or whichever key is assigned to input-accept-variant) is pressed. diff --git a/editions/tw5.com/tiddlers/releasenotes/5.4.0/escapecss-split.tid b/editions/tw5.com/tiddlers/releasenotes/5.4.0/escapecss-split.tid new file mode 100644 index 000000000..7a9ee2b9d --- /dev/null +++ b/editions/tw5.com/tiddlers/releasenotes/5.4.0/escapecss-split.tid @@ -0,0 +1,10 @@ +title: $:/changenotes/5.4.0/#9475 +description: Split escapecss.js into two platforms +release: 5.4.0 +tags: $:/tags/ChangeNote +change-type: performance +change-category: internal +github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9475 +github-contributors: Leilei332 + +Split [[$:/core/modules/utils/escapecss.js]] for two platforms: one for the browser, the other for Node.js. The `CSS.escape` polyfill is moved to `core-server`. \ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs index aa301542b..8f75edd95 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -104,7 +104,7 @@ js.configs.recommended, "init-declarations": "off", "@stylistic/jsx-quotes": "error", "@stylistic/key-spacing": "off", - "@stylistic/keyword-spacing": ["error", { + "@stylistic/keyword-spacing": ["warn", { before: true, after: false, overrides: { @@ -114,6 +114,7 @@ js.configs.recommended, return: { after: true }, throw: { after: true }, try: { after: true }, + const: { after: true } }, }], "@stylistic/line-comment-position": "off", diff --git a/languages/zh-Hans/Misc.multids b/languages/zh-Hans/Misc.multids index 030e30c6a..37ea0c7b1 100644 --- a/languages/zh-Hans/Misc.multids +++ b/languages/zh-Hans/Misc.multids @@ -1,5 +1,6 @@ title: $:/language/ +Alerts: 警报信息 AboveStory/ClassicPlugin/Warning: 您似乎要加载为 ~TiddlyWiki 经典版设计的插件。请注意,[[这些插件无法运行于 TiddlyWiki 5.x.x 版|https://tiddlywiki.com/#TiddlyWikiClassic]]。检测到 ~TiddlyWiki 经典版插件: BinaryWarning/Prompt: 此条目包含二进制数据 ClassicWarning/Hint: 此条目以经典版 TiddlyWiki 标记格式撰写,不完全兼容新版 TiddlyWiki 的格式,详细信息请参阅:https://tiddlywiki.com/static/Upgrading。 diff --git a/languages/zh-Hant/Misc.multids b/languages/zh-Hant/Misc.multids index 4315076b6..28ad6cd73 100644 --- a/languages/zh-Hant/Misc.multids +++ b/languages/zh-Hant/Misc.multids @@ -1,5 +1,6 @@ title: $:/language/ +Alerts: 警示訊息 AboveStory/ClassicPlugin/Warning: 您似乎要載入為 ~TiddlyWiki 經典版設計的插件。請注意,[[這些插件無法運行於 TiddlyWiki 5.x.x 版|https://tiddlywiki.com/#TiddlyWikiClassic]]。偵測到 ~TiddlyWiki 經典版插件: BinaryWarning/Prompt: 此條目包含二進位資料 ClassicWarning/Hint: 此條目以經典版 TiddlyWiki 標記格式撰寫,不完全相容新版 TiddlyWiki 的格式,詳細資訊請參閱:https://tiddlywiki.com/static/Upgrading。