xmlui 0.11.2 → 0.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/{index-DyhCY6Ga.js → index-Cq0EMm3L.js} +390 -347
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-DN7MXrdn.js → initMock-DCigV4Zh.js} +1 -1
- package/dist/lib/language-server-web-worker.js +1 -1
- package/dist/lib/language-server.js +1 -1
- package/dist/lib/{metadata-utils-D27cn-XB.js → metadata-utils-BiolWMg9.js} +5 -6
- package/dist/lib/{server-common-2DaoOOL5.js → server-common-DyCHOk-z.js} +206 -90
- package/dist/lib/testing.js +1 -1
- package/dist/lib/{transform-Tooy42EB.js → transform-DHf9tQF7.js} +15 -1
- package/dist/lib/vite-xmlui-plugin/index.js +19 -2
- package/dist/lib/{xmlui-parser-BZZ430Wm.js → xmlui-parser-CHN3mADy.js} +1 -1
- package/dist/lib/xmlui-parser.d.ts +2 -0
- package/dist/lib/xmlui-parser.js +2 -2
- package/dist/lib/{xmlui-serializer-D9D2mQ8m.js → xmlui-serializer-CYNSHAlP.js} +1 -1
- package/dist/lib/xmlui.d.ts +2 -1
- package/dist/lib/xmlui.js +3 -3
- package/dist/metadata/{collectedComponentMetadata-BNSnCrzh.js → collectedComponentMetadata-CLaDZhmc.js} +401 -343
- package/dist/metadata/{initMock-CVnDRyRf.js → initMock-Buqah4JF.js} +1 -1
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.js +1 -1
- package/dist/metadata/xmlui-metadata.umd.cjs +3 -3
- package/dist/scripts/package.json +1 -1
- package/dist/scripts/src/components/AutoComplete/AutoComplete.spec.js +113 -0
- package/dist/scripts/src/components/Charts/BarChart/BarChartNative.js +10 -4
- package/dist/scripts/src/components/Charts/LabelList/LabelList.js +2 -2
- package/dist/scripts/src/components/Charts/LabelList/LabelListNative.js +2 -2
- package/dist/scripts/src/components/Charts/LineChart/LineChartNative.js +1 -1
- package/dist/scripts/src/components/Checkbox/Checkbox.js +6 -6
- package/dist/scripts/src/components/Checkbox/Checkbox.spec.js +30 -99
- package/dist/scripts/src/components/ColorPicker/ColorPicker.spec.js +57 -14
- package/dist/scripts/src/components/DateInput/DateInput.spec.js +88 -17
- package/dist/scripts/src/components/DatePicker/DatePicker.spec.js +9 -9
- package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +111 -86
- package/dist/scripts/src/components/RadioGroup/RadioGroup.js +6 -6
- package/dist/scripts/src/components/RadioGroup/RadioGroup.spec.js +30 -28
- package/dist/scripts/src/components/RadioGroup/RadioItemNative.js +1 -1
- package/dist/scripts/src/components/Select/Select.js +1 -1
- package/dist/scripts/src/components/Select/Select.spec.js +92 -0
- package/dist/scripts/src/components/Slider/Slider.js +5 -5
- package/dist/scripts/src/components/Slider/Slider.spec.js +63 -29
- package/dist/scripts/src/components/Splitter/Splitter.js +53 -3
- package/dist/scripts/src/components/Splitter/Splitter.spec.js +313 -0
- package/dist/scripts/src/components/Splitter/SplitterNative.js +48 -22
- package/dist/scripts/src/components/Splitter/utils.js +7 -2
- package/dist/scripts/src/components/Switch/Switch.js +6 -6
- package/dist/scripts/src/components/Switch/Switch.spec.js +44 -46
- package/dist/scripts/src/components/Text/Text.js +17 -16
- package/dist/scripts/src/components/Text/Text.spec.js +284 -0
- package/dist/scripts/src/components/TextArea/TextArea.spec.js +94 -2
- package/dist/scripts/src/components/TextBox/TextBox.js +5 -3
- package/dist/scripts/src/components/TextBox/TextBox.spec.js +92 -59
- package/dist/scripts/src/components/TimeInput/TimeInput.spec.js +101 -25
- package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +5 -4
- package/dist/scripts/src/language-server/services/common/syntax-node-utilities.js +23 -31
- package/dist/scripts/src/language-server/services/format.js +223 -84
- package/dist/scripts/src/parsers/xmlui-parser/parser.js +3 -2
- package/dist/scripts/src/parsers/xmlui-parser/syntax-node.js +16 -0
- package/dist/standalone/xmlui-standalone.es.d.ts +4 -2
- package/dist/standalone/xmlui-standalone.umd.js +36 -36
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { delay as delay$1, HttpResponse, matchRequestUrl } from "msw";
|
|
2
2
|
import { isArray, isObject, mapValues } from "lodash-es";
|
|
3
|
-
import { r as runEventHandlerCode, g as getDate, d as delay, m as miscellaneousUtils, a as dateFunctions, o as orderBy, T as ThrowStatementError } from "./index-
|
|
3
|
+
import { r as runEventHandlerCode, g as getDate, d as delay, m as miscellaneousUtils, a as dateFunctions, o as orderBy, T as ThrowStatementError } from "./index-Cq0EMm3L.js";
|
|
4
4
|
import Dexie from "dexie";
|
|
5
5
|
var HttpStatusCode = /* @__PURE__ */ ((HttpStatusCode2) => {
|
|
6
6
|
HttpStatusCode2[HttpStatusCode2["Continue"] = 100] = "Continue";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as onPrefixRegex, x as stripOnPrefix } from "./transform-
|
|
1
|
+
import { u as onPrefixRegex, x as stripOnPrefix } from "./transform-DHf9tQF7.js";
|
|
2
2
|
const LinkTargetMd = [
|
|
3
3
|
{
|
|
4
4
|
value: "_self",
|
|
@@ -473,11 +473,10 @@ export {
|
|
|
473
473
|
iconPositionNames as n,
|
|
474
474
|
orientationOptionMd as o,
|
|
475
475
|
buttonVariantNames as p,
|
|
476
|
-
|
|
477
|
-
|
|
476
|
+
httpMethodNames as q,
|
|
477
|
+
orientationOptionValues as r,
|
|
478
478
|
sizeMd as s,
|
|
479
479
|
triggerPositionNames as t,
|
|
480
|
-
|
|
481
|
-
validationStatusMd as v
|
|
482
|
-
viewportSizeNames as w
|
|
480
|
+
viewportSizeNames as u,
|
|
481
|
+
validationStatusMd as v
|
|
483
482
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CompletionItemKind as CompletionItemKind$1, MarkupKind as MarkupKind$1, TextDocuments as TextDocuments$1, TextDocumentSyncKind, DidChangeConfigurationNotification } from "vscode-languageserver";
|
|
2
2
|
import { TextDocument as TextDocument$1 } from "vscode-languageserver-textdocument";
|
|
3
|
-
import { S as SyntaxKind, B as findTokenAtPos, h as createXmlUiParser } from "./transform-
|
|
4
|
-
import { a as addOnPrefix, M as MetadataProvider } from "./metadata-utils-
|
|
3
|
+
import { S as SyntaxKind, B as findTokenAtPos, h as createXmlUiParser } from "./transform-DHf9tQF7.js";
|
|
4
|
+
import { a as addOnPrefix, M as MetadataProvider } from "./metadata-utils-BiolWMg9.js";
|
|
5
5
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
6
6
|
function getAugmentedNamespace(n) {
|
|
7
7
|
if (n.__esModule) return n;
|
|
@@ -24418,7 +24418,9 @@ function insideClosingTag(pathToElementNode) {
|
|
|
24418
24418
|
if (inputWasOnlyAnElementNode) {
|
|
24419
24419
|
return false;
|
|
24420
24420
|
}
|
|
24421
|
-
const idxClosingStartToken = elementNode.children.findIndex(
|
|
24421
|
+
const idxClosingStartToken = elementNode.children.findIndex(
|
|
24422
|
+
(n) => n.kind === SyntaxKind.CloseNodeStart
|
|
24423
|
+
);
|
|
24422
24424
|
if (idxClosingStartToken === -1) {
|
|
24423
24425
|
return false;
|
|
24424
24426
|
}
|
|
@@ -24450,15 +24452,6 @@ function getFirstNodeFromAncestorChain(chain, kind) {
|
|
|
24450
24452
|
}
|
|
24451
24453
|
return null;
|
|
24452
24454
|
}
|
|
24453
|
-
function getTriviaNodes(node) {
|
|
24454
|
-
if (node.pos === node.start) {
|
|
24455
|
-
return [];
|
|
24456
|
-
} else if (node.triviaBefore) {
|
|
24457
|
-
return node.triviaBefore;
|
|
24458
|
-
} else {
|
|
24459
|
-
return getTriviaNodes(node.children[0]);
|
|
24460
|
-
}
|
|
24461
|
-
}
|
|
24462
24455
|
function handleCompletionResolve({
|
|
24463
24456
|
item,
|
|
24464
24457
|
metaByComp: metaByComp2
|
|
@@ -24856,20 +24849,21 @@ function handleDocumentFormatting({
|
|
|
24856
24849
|
}
|
|
24857
24850
|
class XmluiFormatter {
|
|
24858
24851
|
constructor(node, getText, options) {
|
|
24852
|
+
this.maxConsecutiveNewlines = 2;
|
|
24853
|
+
this.maxLineLength = 80;
|
|
24859
24854
|
this.newlineToken = "\n";
|
|
24860
24855
|
this.getText = getText;
|
|
24861
24856
|
this.startingNode = node;
|
|
24862
24857
|
this.indentationLvl = 0;
|
|
24863
|
-
this.maxLineLength = 80;
|
|
24864
24858
|
this.tabSize = options.tabSize;
|
|
24865
24859
|
this.indentationToken = options.insertSpaces ? " ".repeat(options.tabSize) : " ";
|
|
24866
24860
|
if (options.insertFinalNewline && !options.trimFinalNewlines) {
|
|
24867
|
-
this.
|
|
24868
|
-
return formatted.
|
|
24861
|
+
this.trimRespectingOptions = (formatted) => {
|
|
24862
|
+
return formatted.trim() + this.newlineToken;
|
|
24869
24863
|
};
|
|
24870
24864
|
} else {
|
|
24871
|
-
this.
|
|
24872
|
-
return formatted.
|
|
24865
|
+
this.trimRespectingOptions = (formatted) => {
|
|
24866
|
+
return formatted.trim();
|
|
24873
24867
|
};
|
|
24874
24868
|
}
|
|
24875
24869
|
}
|
|
@@ -24879,15 +24873,11 @@ class XmluiFormatter {
|
|
|
24879
24873
|
formattedStr = this.getText(this.startingNode);
|
|
24880
24874
|
}
|
|
24881
24875
|
formattedStr = this.printContentListNode(this.startingNode);
|
|
24882
|
-
formattedStr = this.
|
|
24876
|
+
formattedStr = this.trimRespectingOptions(formattedStr);
|
|
24883
24877
|
return formattedStr;
|
|
24884
24878
|
}
|
|
24885
24879
|
printContentListNode(node) {
|
|
24886
|
-
let acc =
|
|
24887
|
-
if (!node.children) {
|
|
24888
|
-
acc += this.getText(node);
|
|
24889
|
-
return acc;
|
|
24890
|
-
}
|
|
24880
|
+
let acc = "";
|
|
24891
24881
|
for (let i = 0; i < node.children.length; i++) {
|
|
24892
24882
|
const c = node.children[i];
|
|
24893
24883
|
const prevChild = i > 0 ? node.children[i - 1] : null;
|
|
@@ -24895,37 +24885,17 @@ class XmluiFormatter {
|
|
|
24895
24885
|
case SyntaxKind.CData:
|
|
24896
24886
|
case SyntaxKind.Script:
|
|
24897
24887
|
case SyntaxKind.ElementNode: {
|
|
24898
|
-
|
|
24899
|
-
const prevIsText = (prevChild == null ? void 0 : prevChild.kind) === SyntaxKind.TextNode;
|
|
24900
|
-
if (comment2) {
|
|
24901
|
-
let commentInline = true;
|
|
24902
|
-
if (this.hasNewlineTriviaBeforeComment(c)) {
|
|
24903
|
-
commentInline = false;
|
|
24904
|
-
} else if (prevIsText) {
|
|
24905
|
-
const prevText = this.getText(prevChild);
|
|
24906
|
-
commentInline = !hasNewlineInTrailingWhitespace(prevText);
|
|
24907
|
-
}
|
|
24908
|
-
if (commentInline) {
|
|
24909
|
-
if (acc.at(-1) === this.newlineToken) {
|
|
24910
|
-
acc = acc.substring(0, acc.length - this.newlineToken.length);
|
|
24911
|
-
}
|
|
24912
|
-
acc += ` ${comment2}${this.newlineToken}`;
|
|
24913
|
-
} else {
|
|
24914
|
-
acc += this.indent(this.indentationLvl) + comment2 + this.newlineToken;
|
|
24915
|
-
}
|
|
24916
|
-
}
|
|
24917
|
-
acc += this.indent(this.indentationLvl);
|
|
24888
|
+
acc += this.printTagLikeTriviaInContent(prevChild, c);
|
|
24918
24889
|
acc += this.printTagLike(c);
|
|
24919
|
-
acc += this.newlineToken;
|
|
24920
24890
|
break;
|
|
24921
24891
|
}
|
|
24922
24892
|
case SyntaxKind.StringLiteral:
|
|
24923
24893
|
case SyntaxKind.TextNode: {
|
|
24924
24894
|
const formattedContent = this.printContentString(c);
|
|
24925
24895
|
if (formattedContent !== "") {
|
|
24896
|
+
acc += this.newlineToken;
|
|
24926
24897
|
acc += this.indent(this.indentationLvl);
|
|
24927
24898
|
acc += formattedContent;
|
|
24928
|
-
acc += this.newlineToken;
|
|
24929
24899
|
} else {
|
|
24930
24900
|
acc.trimEnd();
|
|
24931
24901
|
}
|
|
@@ -24934,17 +24904,164 @@ class XmluiFormatter {
|
|
|
24934
24904
|
case SyntaxKind.ErrorNode:
|
|
24935
24905
|
acc += this.getText(c, false);
|
|
24936
24906
|
break;
|
|
24937
|
-
case SyntaxKind.EndOfFileToken:
|
|
24938
|
-
const
|
|
24939
|
-
|
|
24940
|
-
|
|
24941
|
-
|
|
24942
|
-
|
|
24943
|
-
|
|
24907
|
+
case SyntaxKind.EndOfFileToken: {
|
|
24908
|
+
const collapsedTrivias = this.collapseBlankLines(c.triviaBefore ?? []);
|
|
24909
|
+
acc += this.addWsToCollapsedTriviaInContentList(collapsedTrivias, prevChild);
|
|
24910
|
+
break;
|
|
24911
|
+
}
|
|
24912
|
+
}
|
|
24913
|
+
}
|
|
24914
|
+
return acc;
|
|
24915
|
+
}
|
|
24916
|
+
printTagLikeTriviaInContent(prevSibling, node) {
|
|
24917
|
+
if (!prevSibling) {
|
|
24918
|
+
return this.printTriviaBeforeFirstTaglikeInContent(node);
|
|
24919
|
+
} else if (prevSibling.isTagLike()) {
|
|
24920
|
+
return this.printTriviaBetweenSiblingTaglikes(node, prevSibling);
|
|
24921
|
+
} else if (prevSibling.kind === SyntaxKind.TextNode || prevSibling.kind === SyntaxKind.StringLiteral) {
|
|
24922
|
+
return this.printTriviaBetweenTextAndTaglike(prevSibling, node);
|
|
24923
|
+
} else {
|
|
24924
|
+
return this.printTriviaBetweenSiblingTaglikes(node, prevSibling);
|
|
24925
|
+
}
|
|
24926
|
+
}
|
|
24927
|
+
printTriviaBetweenTextAndTaglike(textNode, node) {
|
|
24928
|
+
let acc = "";
|
|
24929
|
+
const trivias = node.getTriviaNodes() ?? [];
|
|
24930
|
+
const collapsedTrivias = this.collapseBlankLines(trivias);
|
|
24931
|
+
acc += this.addWsToCollapsedTriviaInContentList(collapsedTrivias, textNode);
|
|
24932
|
+
return acc;
|
|
24933
|
+
}
|
|
24934
|
+
printTriviaBeforeFirstTaglikeInContent(node) {
|
|
24935
|
+
const triviaBetweenTaglikes = node.getTriviaNodes();
|
|
24936
|
+
if (!triviaBetweenTaglikes) {
|
|
24937
|
+
if (node.start === 0) return "";
|
|
24938
|
+
return this.newlineToken + this.indent(this.indentationLvl);
|
|
24939
|
+
}
|
|
24940
|
+
const collapsedTrivias = this.collapseBlankLines(triviaBetweenTaglikes);
|
|
24941
|
+
let acc = this.addWsToCollapsedTriviaInContentList(collapsedTrivias, null);
|
|
24942
|
+
return acc;
|
|
24943
|
+
}
|
|
24944
|
+
printTriviaBetweenSiblingTaglikes(node, prevNode) {
|
|
24945
|
+
const triviaBetweenTaglikes = node.getTriviaNodes();
|
|
24946
|
+
if (!triviaBetweenTaglikes) {
|
|
24947
|
+
return this.newlineToken + this.indent(this.indentationLvl);
|
|
24948
|
+
}
|
|
24949
|
+
const collapsedTrivias = this.collapseBlankLines(triviaBetweenTaglikes);
|
|
24950
|
+
let acc = this.addWsToCollapsedTriviaInContentList(collapsedTrivias, prevNode);
|
|
24951
|
+
return acc;
|
|
24952
|
+
}
|
|
24953
|
+
/* Filters out trivias so that only comments and newline remain.
|
|
24954
|
+
Respects the maximum permitted consecitive blank lines and throws out any extra consecutive newlines. */
|
|
24955
|
+
collapseBlankLines(trivias) {
|
|
24956
|
+
let consecutiveNewlines = 0;
|
|
24957
|
+
const accTrivias = [];
|
|
24958
|
+
for (let t of trivias) {
|
|
24959
|
+
if (t.kind === SyntaxKind.NewLineTrivia) {
|
|
24960
|
+
consecutiveNewlines++;
|
|
24961
|
+
if (consecutiveNewlines <= this.maxConsecutiveNewlines) {
|
|
24962
|
+
accTrivias.push(t);
|
|
24963
|
+
}
|
|
24964
|
+
} else if (t.kind === SyntaxKind.CommentTrivia) {
|
|
24965
|
+
consecutiveNewlines = 0;
|
|
24966
|
+
accTrivias.push(t);
|
|
24967
|
+
}
|
|
24968
|
+
}
|
|
24969
|
+
return accTrivias;
|
|
24970
|
+
}
|
|
24971
|
+
addWsToCollapsedTriviaInContentList(trivias, prevContentNode) {
|
|
24972
|
+
var _a2;
|
|
24973
|
+
let newlinesAfterText = null;
|
|
24974
|
+
let newlinesFromText = null;
|
|
24975
|
+
let prevContentIsText = false;
|
|
24976
|
+
let newlinesBeforeFirstComment = " ";
|
|
24977
|
+
if (prevContentNode) {
|
|
24978
|
+
prevContentIsText = prevContentNode.kind === SyntaxKind.StringLiteral || prevContentNode.kind === SyntaxKind.TextNode;
|
|
24979
|
+
if (prevContentIsText) {
|
|
24980
|
+
const trailingNewlinesInText = newlinesInTrailingWhitespace(this.getText(prevContentNode));
|
|
24981
|
+
newlinesAfterText = Math.min(trailingNewlinesInText, this.maxConsecutiveNewlines);
|
|
24982
|
+
if (newlinesAfterText > 0) {
|
|
24983
|
+
newlinesFromText = this.newlineToken.repeat(newlinesAfterText);
|
|
24984
|
+
newlinesBeforeFirstComment = newlinesFromText + this.indent(this.indentationLvl);
|
|
24985
|
+
}
|
|
24986
|
+
}
|
|
24987
|
+
}
|
|
24988
|
+
let acc = "";
|
|
24989
|
+
let lastKeptTriviaIsComment = false;
|
|
24990
|
+
for (let i = 0; i < trivias.length; i++) {
|
|
24991
|
+
const t = trivias[i];
|
|
24992
|
+
switch (t.kind) {
|
|
24993
|
+
case SyntaxKind.CommentTrivia: {
|
|
24994
|
+
if (i === 0) {
|
|
24995
|
+
acc += newlinesBeforeFirstComment;
|
|
24996
|
+
acc += this.getText(t);
|
|
24997
|
+
} else {
|
|
24998
|
+
acc += this.indent(this.indentationLvl) + this.getText(t);
|
|
24999
|
+
}
|
|
25000
|
+
if (((_a2 = trivias[i + 1]) == null ? void 0 : _a2.kind) === SyntaxKind.CommentTrivia) {
|
|
25001
|
+
acc += this.newlineToken;
|
|
24944
25002
|
}
|
|
25003
|
+
lastKeptTriviaIsComment = true;
|
|
24945
25004
|
break;
|
|
25005
|
+
}
|
|
25006
|
+
case SyntaxKind.NewLineTrivia: {
|
|
25007
|
+
acc += this.newlineToken;
|
|
25008
|
+
lastKeptTriviaIsComment = false;
|
|
25009
|
+
break;
|
|
25010
|
+
}
|
|
24946
25011
|
}
|
|
24947
25012
|
}
|
|
25013
|
+
if (lastKeptTriviaIsComment) {
|
|
25014
|
+
acc += this.newlineToken;
|
|
25015
|
+
} else if (trivias.length === 0) {
|
|
25016
|
+
acc += newlinesFromText ?? this.newlineToken;
|
|
25017
|
+
}
|
|
25018
|
+
acc += this.indent(this.indentationLvl);
|
|
25019
|
+
return acc;
|
|
25020
|
+
}
|
|
25021
|
+
addWsToCollapsedCloseNodeStartTrivia(trivias, lastContentNode) {
|
|
25022
|
+
var _a2, _b;
|
|
25023
|
+
let newlinesAfterText = null;
|
|
25024
|
+
let lastContentIsText = false;
|
|
25025
|
+
if (lastContentNode) {
|
|
25026
|
+
if (lastContentNode.kind === SyntaxKind.StringLiteral || lastContentNode.kind === SyntaxKind.TextNode) {
|
|
25027
|
+
lastContentIsText = true;
|
|
25028
|
+
const trailingNewlinesInText = newlinesInTrailingWhitespace(this.getText(lastContentNode));
|
|
25029
|
+
newlinesAfterText = Math.min(trailingNewlinesInText, this.maxConsecutiveNewlines);
|
|
25030
|
+
}
|
|
25031
|
+
}
|
|
25032
|
+
const contentEndsInNewlines = lastContentIsText && newlinesAfterText > 0;
|
|
25033
|
+
let acc = "";
|
|
25034
|
+
if (contentEndsInNewlines) {
|
|
25035
|
+
acc += this.newlineToken.repeat(newlinesAfterText);
|
|
25036
|
+
}
|
|
25037
|
+
for (let i = 0; i < trivias.length; ++i) {
|
|
25038
|
+
const t = trivias[i];
|
|
25039
|
+
switch (t.kind) {
|
|
25040
|
+
case SyntaxKind.CommentTrivia: {
|
|
25041
|
+
if (i === 0 && (lastContentIsText && newlinesAfterText === 0 || !lastContentIsText)) {
|
|
25042
|
+
acc += " ";
|
|
25043
|
+
acc += this.getText(t);
|
|
25044
|
+
} else {
|
|
25045
|
+
acc += this.indent(this.indentationLvl + 1) + this.getText(t);
|
|
25046
|
+
}
|
|
25047
|
+
if (((_a2 = trivias[i + 1]) == null ? void 0 : _a2.kind) === SyntaxKind.CommentTrivia) {
|
|
25048
|
+
acc += this.newlineToken;
|
|
25049
|
+
}
|
|
25050
|
+
break;
|
|
25051
|
+
}
|
|
25052
|
+
case SyntaxKind.NewLineTrivia: {
|
|
25053
|
+
acc += this.newlineToken;
|
|
25054
|
+
break;
|
|
25055
|
+
}
|
|
25056
|
+
}
|
|
25057
|
+
}
|
|
25058
|
+
if (!lastContentNode && trivias.length === 0) ;
|
|
25059
|
+
else if (contentEndsInNewlines || ((_b = trivias.at(-1)) == null ? void 0 : _b.kind) === SyntaxKind.NewLineTrivia) {
|
|
25060
|
+
acc += this.indent(this.indentationLvl);
|
|
25061
|
+
} else {
|
|
25062
|
+
acc += this.newlineToken;
|
|
25063
|
+
acc += this.indent(this.indentationLvl);
|
|
25064
|
+
}
|
|
24948
25065
|
return acc;
|
|
24949
25066
|
}
|
|
24950
25067
|
printTagLike(node) {
|
|
@@ -24962,33 +25079,34 @@ class XmluiFormatter {
|
|
|
24962
25079
|
const hasContentList = contentListIdx !== -1;
|
|
24963
25080
|
const closeNodeStartIdx = node.children.findIndex((c) => c.kind === SyntaxKind.CloseNodeStart);
|
|
24964
25081
|
const hasCloseNodeStart = closeNodeStartIdx !== -1;
|
|
24965
|
-
let
|
|
25082
|
+
let nodesOfOpenTagNodeEndIdx;
|
|
24966
25083
|
if (hasContentList) {
|
|
24967
|
-
|
|
25084
|
+
nodesOfOpenTagNodeEndIdx = contentListIdx;
|
|
24968
25085
|
} else if (hasCloseNodeStart) {
|
|
24969
|
-
|
|
25086
|
+
nodesOfOpenTagNodeEndIdx = closeNodeStartIdx;
|
|
24970
25087
|
} else {
|
|
24971
|
-
|
|
25088
|
+
nodesOfOpenTagNodeEndIdx = node.children.length;
|
|
24972
25089
|
}
|
|
24973
|
-
const
|
|
24974
|
-
acc += this.printOpenTag(
|
|
25090
|
+
const nodesOfOpenTagNode = node.children.slice(0, nodesOfOpenTagNodeEndIdx);
|
|
25091
|
+
acc += this.printOpenTag(nodesOfOpenTagNode);
|
|
25092
|
+
let lastContentNode = null;
|
|
24975
25093
|
if (hasContentList) {
|
|
24976
25094
|
const contentListNode = node.children[contentListIdx];
|
|
25095
|
+
lastContentNode = contentListNode.children.at(-1);
|
|
24977
25096
|
++this.indentationLvl;
|
|
24978
|
-
acc += this.newlineToken;
|
|
24979
25097
|
acc += this.printContentListNode(contentListNode);
|
|
24980
25098
|
--this.indentationLvl;
|
|
24981
25099
|
}
|
|
24982
|
-
let
|
|
25100
|
+
let nodesOfCloseTagNodeStartIdx;
|
|
24983
25101
|
if (hasCloseNodeStart) {
|
|
24984
|
-
|
|
25102
|
+
nodesOfCloseTagNodeStartIdx = closeNodeStartIdx;
|
|
24985
25103
|
} else if (hasContentList) {
|
|
24986
|
-
|
|
25104
|
+
nodesOfCloseTagNodeStartIdx = contentListIdx + 1;
|
|
24987
25105
|
} else {
|
|
24988
|
-
|
|
25106
|
+
nodesOfCloseTagNodeStartIdx = nodesOfOpenTagNodeEndIdx + 1;
|
|
24989
25107
|
}
|
|
24990
|
-
const closeTagNodes = node.children.slice(
|
|
24991
|
-
acc += this.printClosingTag(closeTagNodes,
|
|
25108
|
+
const closeTagNodes = node.children.slice(nodesOfCloseTagNodeStartIdx);
|
|
25109
|
+
acc += this.printClosingTag(closeTagNodes, lastContentNode);
|
|
24992
25110
|
return acc;
|
|
24993
25111
|
}
|
|
24994
25112
|
printOpenTag(tagChildren) {
|
|
@@ -25016,21 +25134,15 @@ class XmluiFormatter {
|
|
|
25016
25134
|
}
|
|
25017
25135
|
return acc;
|
|
25018
25136
|
}
|
|
25019
|
-
printClosingTag(tagChildren,
|
|
25137
|
+
printClosingTag(tagChildren, lastContentNode) {
|
|
25020
25138
|
let acc = "";
|
|
25021
25139
|
for (let i = 0; i < tagChildren.length; ++i) {
|
|
25022
25140
|
const c = tagChildren[i];
|
|
25023
25141
|
switch (c.kind) {
|
|
25024
25142
|
case SyntaxKind.CloseNodeStart:
|
|
25025
|
-
const
|
|
25026
|
-
|
|
25027
|
-
|
|
25028
|
-
acc += this.newlineToken;
|
|
25029
|
-
}
|
|
25030
|
-
acc += this.indent(this.indentationLvl + 1);
|
|
25031
|
-
acc += comment + this.newlineToken;
|
|
25032
|
-
}
|
|
25033
|
-
acc += this.indent(this.indentationLvl) + "</";
|
|
25143
|
+
const collapsedTrivias = this.collapseBlankLines(c.triviaBefore ?? []);
|
|
25144
|
+
acc += this.addWsToCollapsedCloseNodeStartTrivia(collapsedTrivias, lastContentNode);
|
|
25145
|
+
acc += "</";
|
|
25034
25146
|
break;
|
|
25035
25147
|
case SyntaxKind.TagNameNode:
|
|
25036
25148
|
acc += this.printTagName(c);
|
|
@@ -25056,12 +25168,13 @@ class XmluiFormatter {
|
|
|
25056
25168
|
case SyntaxKind.AttributeListNode:
|
|
25057
25169
|
attrSegmentsFormatted = this.printAttrList(c);
|
|
25058
25170
|
attrsAlreadyMultiline = c.children.some(
|
|
25059
|
-
(attr) =>
|
|
25171
|
+
(attr) => {
|
|
25172
|
+
var _a2;
|
|
25173
|
+
return (_a2 = attr.getTriviaNodes()) == null ? void 0 : _a2.some((attrTrivia) => attrTrivia.kind === SyntaxKind.NewLineTrivia);
|
|
25174
|
+
}
|
|
25060
25175
|
);
|
|
25061
|
-
acc.length;
|
|
25062
25176
|
break;
|
|
25063
25177
|
case SyntaxKind.NodeClose: {
|
|
25064
|
-
acc.length;
|
|
25065
25178
|
closingIsNodeClose = true;
|
|
25066
25179
|
const comments = this.getCommentsSpaceJoined(c);
|
|
25067
25180
|
if (comments) {
|
|
@@ -25072,7 +25185,6 @@ class XmluiFormatter {
|
|
|
25072
25185
|
break;
|
|
25073
25186
|
}
|
|
25074
25187
|
case SyntaxKind.NodeEnd: {
|
|
25075
|
-
acc.length;
|
|
25076
25188
|
closingIsNodeClose = false;
|
|
25077
25189
|
const comments = this.getCommentsSpaceJoined(c);
|
|
25078
25190
|
if (comments) {
|
|
@@ -25198,14 +25310,11 @@ class XmluiFormatter {
|
|
|
25198
25310
|
printContentString(node) {
|
|
25199
25311
|
return this.getText(node, false).trim();
|
|
25200
25312
|
}
|
|
25201
|
-
printEveryTrivia(node) {
|
|
25202
|
-
return (node.triviaBefore ?? []).map((trivia) => this.getText(trivia)).join("");
|
|
25203
|
-
}
|
|
25204
25313
|
indent(lvl) {
|
|
25205
25314
|
return this.indentationToken.repeat(lvl);
|
|
25206
25315
|
}
|
|
25207
25316
|
getComments(node) {
|
|
25208
|
-
const triviaNodes = getTriviaNodes(
|
|
25317
|
+
const triviaNodes = node.getTriviaNodes() ?? [];
|
|
25209
25318
|
return triviaNodes.filter(({ kind }) => kind === SyntaxKind.CommentTrivia).map((comment) => this.getText(comment));
|
|
25210
25319
|
}
|
|
25211
25320
|
/**
|
|
@@ -25224,7 +25333,10 @@ class XmluiFormatter {
|
|
|
25224
25333
|
* Check if comments have newlines before them
|
|
25225
25334
|
*/
|
|
25226
25335
|
hasNewlineTriviaBeforeComment(node) {
|
|
25227
|
-
const triviaNodes = getTriviaNodes(
|
|
25336
|
+
const triviaNodes = node.getTriviaNodes();
|
|
25337
|
+
if (!triviaNodes) {
|
|
25338
|
+
return false;
|
|
25339
|
+
}
|
|
25228
25340
|
for (let c of triviaNodes) {
|
|
25229
25341
|
if (c.kind === SyntaxKind.NewLineTrivia) {
|
|
25230
25342
|
return true;
|
|
@@ -25237,14 +25349,18 @@ class XmluiFormatter {
|
|
|
25237
25349
|
}
|
|
25238
25350
|
function format(node, getText, options) {
|
|
25239
25351
|
const formatter = new XmluiFormatter(node, getText, options);
|
|
25240
|
-
|
|
25241
|
-
return formattedString;
|
|
25352
|
+
return formatter.format();
|
|
25242
25353
|
}
|
|
25243
|
-
function
|
|
25244
|
-
const lastNewlineIdx = text.lastIndexOf("\n");
|
|
25354
|
+
function newlinesInTrailingWhitespace(text) {
|
|
25245
25355
|
const trimmedPrevText = text.trimEnd();
|
|
25246
|
-
const
|
|
25247
|
-
|
|
25356
|
+
const trailingWhitespace = text.substring(trimmedPrevText.length);
|
|
25357
|
+
let newlineCount = 0;
|
|
25358
|
+
for (const c of trailingWhitespace) {
|
|
25359
|
+
if (c === "\n") {
|
|
25360
|
+
newlineCount++;
|
|
25361
|
+
}
|
|
25362
|
+
}
|
|
25363
|
+
return newlineCount;
|
|
25248
25364
|
}
|
|
25249
25365
|
function getDiagnostics(ctx) {
|
|
25250
25366
|
const { errors } = ctx.parseResult;
|
package/dist/lib/testing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { expect as expect$1, test as test$1 } from "@playwright/test";
|
|
3
|
-
import { x as xmlUiMarkupToComponent, P as PART_START_ADORNMENT, a as PART_END_ADORNMENT, b as PART_INPUT } from "./xmlui-parser-
|
|
3
|
+
import { x as xmlUiMarkupToComponent, P as PART_START_ADORNMENT, a as PART_END_ADORNMENT, b as PART_INPUT } from "./xmlui-parser-CHN3mADy.js";
|
|
4
4
|
import chroma from "chroma-js";
|
|
5
5
|
function mapObject(obj, valFn = (val) => val, keyFn = (val) => val) {
|
|
6
6
|
const newObject = {};
|
|
@@ -4308,6 +4308,9 @@ class Node {
|
|
|
4308
4308
|
isAttributeNode() {
|
|
4309
4309
|
return this.kind === SyntaxKind.AttributeNode;
|
|
4310
4310
|
}
|
|
4311
|
+
isTagLike() {
|
|
4312
|
+
return this.kind === SyntaxKind.ElementNode || this.kind === SyntaxKind.CData || this.kind == SyntaxKind.Script;
|
|
4313
|
+
}
|
|
4311
4314
|
isAttributeKeyNode() {
|
|
4312
4315
|
return this.kind === SyntaxKind.AttributeKeyNode;
|
|
4313
4316
|
}
|
|
@@ -4323,6 +4326,15 @@ class Node {
|
|
|
4323
4326
|
findTokenAtPos(position) {
|
|
4324
4327
|
return findTokenAtPos(this, position);
|
|
4325
4328
|
}
|
|
4329
|
+
getTriviaNodes() {
|
|
4330
|
+
if (this.pos === this.start) {
|
|
4331
|
+
return null;
|
|
4332
|
+
} else if (this.triviaBefore) {
|
|
4333
|
+
return this.triviaBefore;
|
|
4334
|
+
} else {
|
|
4335
|
+
return this.children[0].getTriviaNodes();
|
|
4336
|
+
}
|
|
4337
|
+
}
|
|
4326
4338
|
}
|
|
4327
4339
|
class ElementNode extends Node {
|
|
4328
4340
|
getAttributeListNode() {
|
|
@@ -5029,6 +5041,9 @@ function parseXmlUiMarkup(text) {
|
|
|
5029
5041
|
case SyntaxKind.OpenNodeStart:
|
|
5030
5042
|
parseOpeningTag();
|
|
5031
5043
|
break;
|
|
5044
|
+
case SyntaxKind.TextNode:
|
|
5045
|
+
bumpAny();
|
|
5046
|
+
break;
|
|
5032
5047
|
case SyntaxKind.CloseNodeStart: {
|
|
5033
5048
|
const errNode2 = errNodeUntil(RECOVER_FILE);
|
|
5034
5049
|
errorAt(DIAGS.unexpectedCloseTag, errNode2.pos, errNode2.end);
|
|
@@ -5414,7 +5429,6 @@ function parseXmlUiMarkup(text) {
|
|
|
5414
5429
|
let triviaBefore = void 0;
|
|
5415
5430
|
if (leadingComments.length > 0) {
|
|
5416
5431
|
triviaBefore = leadingComments;
|
|
5417
|
-
leadingComments[0].pos;
|
|
5418
5432
|
}
|
|
5419
5433
|
let kind = SyntaxKind.TextNode;
|
|
5420
5434
|
let end = -1;
|
|
@@ -10812,6 +10812,11 @@ class Node {
|
|
|
10812
10812
|
isAttributeNode() {
|
|
10813
10813
|
return this.kind === syntax_kind_SyntaxKind.AttributeNode;
|
|
10814
10814
|
}
|
|
10815
|
+
isTagLike() {
|
|
10816
|
+
return (this.kind === syntax_kind_SyntaxKind.ElementNode ||
|
|
10817
|
+
this.kind === syntax_kind_SyntaxKind.CData ||
|
|
10818
|
+
this.kind == syntax_kind_SyntaxKind.Script);
|
|
10819
|
+
}
|
|
10815
10820
|
isAttributeKeyNode() {
|
|
10816
10821
|
return this.kind === syntax_kind_SyntaxKind.AttributeKeyNode;
|
|
10817
10822
|
}
|
|
@@ -10827,6 +10832,17 @@ class Node {
|
|
|
10827
10832
|
findTokenAtPos(position) {
|
|
10828
10833
|
return findTokenAtPos(this, position);
|
|
10829
10834
|
}
|
|
10835
|
+
getTriviaNodes() {
|
|
10836
|
+
if (this.pos === this.start) {
|
|
10837
|
+
return null;
|
|
10838
|
+
}
|
|
10839
|
+
else if (this.triviaBefore) {
|
|
10840
|
+
return this.triviaBefore;
|
|
10841
|
+
}
|
|
10842
|
+
else {
|
|
10843
|
+
return this.children[0].getTriviaNodes();
|
|
10844
|
+
}
|
|
10845
|
+
}
|
|
10830
10846
|
}
|
|
10831
10847
|
class ElementNode extends (/* unused pure expression or super */ null && (Node)) {
|
|
10832
10848
|
getAttributeListNode() {
|
|
@@ -11643,6 +11659,9 @@ function parseXmlUiMarkup(text) {
|
|
|
11643
11659
|
case syntax_kind_SyntaxKind.OpenNodeStart:
|
|
11644
11660
|
parseOpeningTag();
|
|
11645
11661
|
break;
|
|
11662
|
+
case syntax_kind_SyntaxKind.TextNode:
|
|
11663
|
+
bumpAny();
|
|
11664
|
+
break;
|
|
11646
11665
|
case syntax_kind_SyntaxKind.CloseNodeStart: {
|
|
11647
11666
|
const errNode = errNodeUntil(RECOVER_FILE);
|
|
11648
11667
|
errorAt(DIAGS.unexpectedCloseTag, errNode.pos, errNode.end);
|
|
@@ -12052,11 +12071,9 @@ function parseXmlUiMarkup(text) {
|
|
|
12052
12071
|
else {
|
|
12053
12072
|
pos = token.start;
|
|
12054
12073
|
}
|
|
12055
|
-
let start = pos;
|
|
12056
12074
|
let triviaBefore = undefined;
|
|
12057
12075
|
if (leadingComments.length > 0) {
|
|
12058
12076
|
triviaBefore = leadingComments;
|
|
12059
|
-
start = leadingComments[0].pos;
|
|
12060
12077
|
}
|
|
12061
12078
|
let kind = syntax_kind_SyntaxKind.TextNode;
|
|
12062
12079
|
let end = -1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as createXmlUiParser, w as nodeToComponentDef, D as DiagnosticCategory, E as ErrCodes, S as SyntaxKind } from "./transform-
|
|
1
|
+
import { h as createXmlUiParser, w as nodeToComponentDef, D as DiagnosticCategory, E as ErrCodes, S as SyntaxKind } from "./transform-DHf9tQF7.js";
|
|
2
2
|
const PART_LABEL = "label";
|
|
3
3
|
const PART_LABELED_ITEM = "labeledItem";
|
|
4
4
|
const PART_INPUT = "input";
|
|
@@ -889,11 +889,13 @@ declare class Node_2 {
|
|
|
889
889
|
constructor(kind: SyntaxKind, pos: number, end: number, triviaBefore?: Node_2[], children?: Node_2[]);
|
|
890
890
|
isElementNode(): this is ElementNode;
|
|
891
891
|
isAttributeNode(): this is AttributeNode;
|
|
892
|
+
isTagLike(): boolean;
|
|
892
893
|
isAttributeKeyNode(): this is AttributeKeyNode;
|
|
893
894
|
isContentListNode(): this is ContentListNode;
|
|
894
895
|
isAttributeListNode(): this is AttributeListNode;
|
|
895
896
|
isTagNameNode(): this is TagNameNode;
|
|
896
897
|
findTokenAtPos(position: number): FindTokenSuccess_2;
|
|
898
|
+
getTriviaNodes(): Node_2[] | null;
|
|
897
899
|
}
|
|
898
900
|
export { Node_2 as Node }
|
|
899
901
|
|
package/dist/lib/xmlui-parser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { q, s, A, t, v, C, r, a, b, f, e, g, c, D, o, E, N, P, S, T, U, j, h, d, i, B, n, k, m, l, w, u, p, x, z, y } from "./transform-
|
|
2
|
-
import { b as b2, L, X, a as a2, c as c2, g as g2, e as e2, l as l2, d as d2, m as m2, p as p2 } from "./xmlui-serializer-
|
|
1
|
+
import { q, s, A, t, v, C, r, a, b, f, e, g, c, D, o, E, N, P, S, T, U, j, h, d, i, B, n, k, m, l, w, u, p, x, z, y } from "./transform-DHf9tQF7.js";
|
|
2
|
+
import { b as b2, L, X, a as a2, c as c2, g as g2, e as e2, l as l2, d as d2, m as m2, p as p2 } from "./xmlui-serializer-CYNSHAlP.js";
|
|
3
3
|
export {
|
|
4
4
|
q as AttributeKeyNode,
|
|
5
5
|
s as AttributeListNode,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as CORE_NAMESPACE_VALUE, t as COMPOUND_COMP_ID } from "./transform-
|
|
1
|
+
import { v as CORE_NAMESPACE_VALUE, t as COMPOUND_COMP_ID } from "./transform-DHf9tQF7.js";
|
|
2
2
|
const componentFileExtension = "xmlui";
|
|
3
3
|
const codeBehindFileExtension = "xmlui.xs";
|
|
4
4
|
const moduleFileExtension = "xs";
|
package/dist/lib/xmlui.d.ts
CHANGED
|
@@ -1413,7 +1413,7 @@ declare type SpinnerProps = {
|
|
|
1413
1413
|
className?: string;
|
|
1414
1414
|
};
|
|
1415
1415
|
|
|
1416
|
-
export declare const Splitter: ({ initialPrimarySize, minPrimarySize, maxPrimarySize, orientation, children, style, className, swapped, floating, splitterTemplate, resize, ...rest }: SplitterProps) => JSX_2.Element;
|
|
1416
|
+
export declare const Splitter: ({ initialPrimarySize, minPrimarySize, maxPrimarySize, orientation, children, style, className, swapped, floating, splitterTemplate, resize, visibleChildCount, ...rest }: SplitterProps) => JSX_2.Element;
|
|
1417
1417
|
|
|
1418
1418
|
declare type SplitterProps = {
|
|
1419
1419
|
children: default_2.ReactNode[] | default_2.ReactNode;
|
|
@@ -1427,6 +1427,7 @@ declare type SplitterProps = {
|
|
|
1427
1427
|
initialPrimarySize?: string;
|
|
1428
1428
|
minPrimarySize?: string;
|
|
1429
1429
|
maxPrimarySize?: string;
|
|
1430
|
+
visibleChildCount?: number;
|
|
1430
1431
|
};
|
|
1431
1432
|
|
|
1432
1433
|
declare type SPREAD_EXPRESSION = typeof T_SPREAD_EXPRESSION;
|
package/dist/lib/xmlui.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { aa, Z, al, a1, _, $, ai, ak, ag, ab, a2, a0, S, ar, b, ao, ap, a4, a5, ae, af, as, aj, ah, ad, c, f, e, h, j, k, l, i, n, p, q, s, u, v, x, w, t, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, P, N, O, Q, R, U, V, a3, W, X, a7, an, a6, a8, aq, a9, am, Y, ac } from "./index-
|
|
2
|
-
import { e as e2, x as x2 } from "./xmlui-parser-
|
|
3
|
-
import { X as X2 } from "./xmlui-serializer-
|
|
1
|
+
import { aa, Z, al, a1, _, $, ai, ak, ag, ab, a2, a0, S, ar, b, ao, ap, a4, a5, ae, af, as, aj, ah, ad, c, f, e, h, j, k, l, i, n, p, q, s, u, v, x, w, t, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, P, N, O, Q, R, U, V, a3, W, X, a7, an, a6, a8, aq, a9, am, Y, ac } from "./index-Cq0EMm3L.js";
|
|
2
|
+
import { e as e2, x as x2 } from "./xmlui-parser-CHN3mADy.js";
|
|
3
|
+
import { X as X2 } from "./xmlui-serializer-CYNSHAlP.js";
|
|
4
4
|
export {
|
|
5
5
|
aa as ApiInterceptorProvider,
|
|
6
6
|
Z as AppRoot,
|