@gramlot/gramlot 0.3.16 → 0.3.17
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/components/editors/__init__.py +1 -1
- package/dist/components/editors/assets/collection.js +16162 -11689
- package/dist/components/editors/assets/index.js +1 -1
- package/dist/components/editors/grammar.json +3 -0
- package/dist/components/inputs/__init__.py +1 -1
- package/dist/components/inputs/assets/collection.js +134 -179
- package/dist/components/inputs/assets/index.js +1 -1
- package/dist/components/inputs/grammar.json +19 -0
- package/dist/components/layout/__init__.py +1 -1
- package/dist/components/layout/assets/collection.js +4643 -3481
- package/dist/components/layout/assets/index.js +1 -1
- package/dist/components/layout/grammar.json +509 -1
- package/dist/components/tree/__init__.py +1 -1
- package/dist/components/tree/assets/collection.js +306 -94
- package/dist/components/tree/assets/index.js +1 -1
- package/dist/components/tree/grammar.json +16 -0
- package/dist/components/typst/__init__.py +1 -1
- package/dist/components/typst/assets/collection.js +2 -2
- package/dist/components/typst/assets/index.js +1 -1
- package/dist/gramlot.js +2124 -506
- package/dist/gramlot.min.js +95 -40
- package/dist/runtime-notices.json +4 -0
- package/package.json +12 -8
- package/src/binding/device-resolver.js +27 -0
- package/src/binding/error-notifications.js +84 -0
- package/src/binding/remote-resolver.d.ts +18 -0
- package/src/binding/remote.js +11 -4
- package/src/binding/runtime.js +6 -2
- package/src/bootstrap.js +4 -4
- package/src/components/buttons.js +10 -3
- package/src/components/code-mirror-engine.js +14 -4
- package/src/components/code-mirror.js +2 -3
- package/src/components/container.js +1 -1
- package/src/components/date-calendar.js +1 -1
- package/src/components/formlet-labels.js +5 -4
- package/src/components/html-document.js +4 -2
- package/src/components/html-editor.js +2 -2
- package/src/components/jodit-engine.js +72 -11
- package/src/components/labelbox.js +19 -63
- package/src/components/layout.js +31 -19
- package/src/components/markdown-document.js +1 -1
- package/src/components/markdown-editor.js +2 -2
- package/src/components/menus.js +7 -6
- package/src/components/prose-mirror-engine.js +14 -1
- package/src/components/registry.js +2 -0
- package/src/components/selected-container.js +107 -14
- package/src/components/toolbar-overflow.js +9 -8
- package/src/components/transform-pane.js +140 -0
- package/src/components/tray-geometry.js +87 -0
- package/src/components/tray-pane.js +435 -0
- package/src/components/tray-settings.js +62 -0
- package/src/components/tree.js +115 -21
- package/src/components/typed-editor.js +1 -1
- package/src/components/typst-client.js +14 -13
- package/src/components/validation.js +1 -1
- package/src/components/window-surface.js +281 -0
- package/src/components/windows.js +32 -261
- package/src/device-frames.js +195 -0
- package/src/filesystem.d.ts +12 -5
- package/src/filesystem.js +8 -8
- package/src/gramlot.d.ts +3 -1
- package/src/gramlot.js +11 -4
- package/src/handlers/device-handler.d.ts +75 -0
- package/src/handlers/device-handler.js +1037 -0
- package/src/handlers/dom-handler.d.ts +2 -0
- package/src/handlers/dom-handler.js +9 -0
- package/src/handlers/rpc-handler.d.ts +2 -2
- package/src/http-transport.d.ts +3 -3
- package/src/http-transport.js +17 -11
- package/src/ide-documents.js +6 -4
- package/src/ide-runtime.d.ts +14 -3
- package/src/ide-runtime.js +123 -94
- package/src/index-page-runtime.d.ts +2 -2
- package/src/index-page-runtime.js +91 -43
- package/src/index-page-styles.js +1 -1
- package/src/index.d.ts +7 -2
- package/src/index.js +5 -1
- package/src/inout.d.ts +1 -1
- package/src/inout.js +5 -1
- package/src/mobile-environment.d.ts +6 -0
- package/src/mobile-environment.js +52 -0
- package/src/navigation-resolver.d.ts +14 -2
- package/src/renderer/attributes.js +5 -2
- package/src/renderer/drag-drop.js +5 -4
- package/src/renderer/gramlot-renderer.d.ts +13 -2
- package/src/renderer/gramlot-renderer.js +49 -13
- package/src/server/index-page.js +4 -4
- package/src/view/controls.js +48 -23
- package/src/view/html.js +85 -4
- package/src/view/labelbox.js +95 -0
- package/themes/gramlot-base/theme.css +4 -0
- package/themes/mela/theme.css +62 -15
- package/src/date-parser/civil.js +0 -61
- package/src/date-parser/index.d.ts +0 -18
- package/src/date-parser/index.js +0 -196
- package/src/date-parser/locales.js +0 -257
|
@@ -6516,7 +6516,7 @@ var require_lib = __commonJS({
|
|
|
6516
6516
|
import { Bag as Bag2 } from "@gramlot/gramlot";
|
|
6517
6517
|
|
|
6518
6518
|
// node_modules/dompurify/dist/purify.es.mjs
|
|
6519
|
-
/*! @license DOMPurify 3.4.
|
|
6519
|
+
/*! @license DOMPurify 3.4.17 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.17/LICENSE */
|
|
6520
6520
|
function _OverloadYield(e, d) {
|
|
6521
6521
|
this.v = e, this.k = d;
|
|
6522
6522
|
}
|
|
@@ -6640,9 +6640,12 @@ Array.prototype.indexOf;
|
|
|
6640
6640
|
var arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
|
|
6641
6641
|
var arrayPop = unapply(Array.prototype.pop);
|
|
6642
6642
|
var arrayPush = unapply(Array.prototype.push);
|
|
6643
|
-
Array.prototype.slice;
|
|
6643
|
+
var arraySlice = unapply(Array.prototype.slice);
|
|
6644
6644
|
var arraySplice = unapply(Array.prototype.splice);
|
|
6645
6645
|
var arrayIsArray = Array.isArray;
|
|
6646
|
+
var setCreate = unconstruct(Set);
|
|
6647
|
+
var setAdd = unapply(Set.prototype.add);
|
|
6648
|
+
var setHas = unapply(Set.prototype.has);
|
|
6646
6649
|
var stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
6647
6650
|
var stringToString = unapply(String.prototype.toString);
|
|
6648
6651
|
var stringMatch = unapply(String.prototype.match);
|
|
@@ -6749,6 +6752,14 @@ function lookupGetter(object, prop) {
|
|
|
6749
6752
|
}
|
|
6750
6753
|
return fallbackValue;
|
|
6751
6754
|
}
|
|
6755
|
+
function lookupAccessor(object, prop) {
|
|
6756
|
+
while (object !== null) {
|
|
6757
|
+
const desc = getOwnPropertyDescriptor(object, prop);
|
|
6758
|
+
if (desc) return desc.get ? unapply(desc.get) : null;
|
|
6759
|
+
object = getPrototypeOf(object);
|
|
6760
|
+
}
|
|
6761
|
+
return null;
|
|
6762
|
+
}
|
|
6752
6763
|
function isRegex(value) {
|
|
6753
6764
|
try {
|
|
6754
6765
|
regExpTest(value, "");
|
|
@@ -7433,7 +7444,7 @@ var NODE_TYPE = {
|
|
|
7433
7444
|
documentFragment: 11,
|
|
7434
7445
|
notation: 12
|
|
7435
7446
|
};
|
|
7436
|
-
var
|
|
7447
|
+
var LITERAL_TEXT_ELEMENTS = freeze(addToSet({}, [
|
|
7437
7448
|
"style",
|
|
7438
7449
|
"script",
|
|
7439
7450
|
"xmp",
|
|
@@ -7442,15 +7453,7 @@ var LITERAL_TEXT_ELEMENT_NAMES = [
|
|
|
7442
7453
|
"noframes",
|
|
7443
7454
|
"plaintext",
|
|
7444
7455
|
"noscript"
|
|
7445
|
-
];
|
|
7446
|
-
var LITERAL_TEXT_ELEMENTS = freeze(addToSet({}, LITERAL_TEXT_ELEMENT_NAMES));
|
|
7447
|
-
var LITERAL_TEXT_CLOSE = (function() {
|
|
7448
|
-
const map = {};
|
|
7449
|
-
arrayForEach(LITERAL_TEXT_ELEMENT_NAMES, (name) => {
|
|
7450
|
-
map[name] = seal(new RegExp("</" + name + "(?=[\\t\\n\\f\\r />])", "i"));
|
|
7451
|
-
});
|
|
7452
|
-
return freeze(map);
|
|
7453
|
-
})();
|
|
7456
|
+
]));
|
|
7454
7457
|
var getGlobal = function getGlobal2() {
|
|
7455
7458
|
return typeof window === "undefined" ? null : window;
|
|
7456
7459
|
};
|
|
@@ -7497,7 +7500,7 @@ var _resolveObjectOption = function _resolveObjectOption2(cfg, key, makeFallback
|
|
|
7497
7500
|
function createDOMPurify() {
|
|
7498
7501
|
let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
|
|
7499
7502
|
const DOMPurify = (root) => createDOMPurify(root);
|
|
7500
|
-
DOMPurify.version = "3.4.
|
|
7503
|
+
DOMPurify.version = "3.4.17";
|
|
7501
7504
|
DOMPurify.removed = [];
|
|
7502
7505
|
if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
|
|
7503
7506
|
DOMPurify.isSupported = false;
|
|
@@ -7529,6 +7532,10 @@ function createDOMPurify() {
|
|
|
7529
7532
|
const _readNodeName = function _readNodeName2(node) {
|
|
7530
7533
|
return getNodeName ? getNodeName(node) : node.nodeName;
|
|
7531
7534
|
};
|
|
7535
|
+
const getNamespaceURI = lookupAccessor(ElementPrototype, "namespaceURI");
|
|
7536
|
+
const _readNamespaceURI = function _readNamespaceURI2(element) {
|
|
7537
|
+
return getNamespaceURI ? getNamespaceURI(element) : element.namespaceURI;
|
|
7538
|
+
};
|
|
7532
7539
|
if (typeof HTMLTemplateElement === "function") {
|
|
7533
7540
|
const template = document.createElement("template");
|
|
7534
7541
|
if (template.content && template.content.ownerDocument) document = template.content.ownerDocument;
|
|
@@ -7642,6 +7649,7 @@ function createDOMPurify() {
|
|
|
7642
7649
|
const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
|
|
7643
7650
|
let KEEP_CONTENT = true;
|
|
7644
7651
|
let IN_PLACE = false;
|
|
7652
|
+
let IN_PLACE_VISITED = null;
|
|
7645
7653
|
let USE_PROFILES = {};
|
|
7646
7654
|
let FORBID_CONTENTS = null;
|
|
7647
7655
|
const DEFAULT_FORBID_CONTENTS = addToSet({}, [
|
|
@@ -7880,18 +7888,23 @@ function createDOMPurify() {
|
|
|
7880
7888
|
return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
|
|
7881
7889
|
};
|
|
7882
7890
|
const _checkValidNamespace = function _checkValidNamespace2(element) {
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7891
|
+
const elementNamespace = _readNamespaceURI(element);
|
|
7892
|
+
const tagName = stringToLowerCase(_readNodeName(element));
|
|
7893
|
+
const parentNode = getParentNode(element);
|
|
7894
|
+
let parent;
|
|
7895
|
+
let parentTagName;
|
|
7896
|
+
if (parentNode && _readNodeType(parentNode) === NODE_TYPE.element) {
|
|
7897
|
+
parent = { namespaceURI: _readNamespaceURI(parentNode) };
|
|
7898
|
+
parentTagName = stringToLowerCase(_readNodeName(parentNode));
|
|
7899
|
+
} else {
|
|
7900
|
+
parent = { namespaceURI: NAMESPACE };
|
|
7901
|
+
parentTagName = "template";
|
|
7902
|
+
}
|
|
7903
|
+
if (!ALLOWED_NAMESPACES[elementNamespace]) return false;
|
|
7904
|
+
if (elementNamespace === SVG_NAMESPACE) return _checkSvgNamespace(tagName, parent, parentTagName);
|
|
7905
|
+
if (elementNamespace === MATHML_NAMESPACE) return _checkMathMlNamespace(tagName, parent, parentTagName);
|
|
7906
|
+
if (elementNamespace === HTML_NAMESPACE) return _checkHtmlNamespace(tagName, parent, parentTagName);
|
|
7907
|
+
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[elementNamespace]) return true;
|
|
7895
7908
|
return false;
|
|
7896
7909
|
};
|
|
7897
7910
|
const _forceRemove = function _forceRemove2(node) {
|
|
@@ -7916,19 +7929,13 @@ function createDOMPurify() {
|
|
|
7916
7929
|
const _neutralizeRoot = function _neutralizeRoot2(root) {
|
|
7917
7930
|
_neutralizeSubtree(root);
|
|
7918
7931
|
const childNodes = getChildNodes(root);
|
|
7919
|
-
if (childNodes) {
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
}
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
remove(child);
|
|
7927
|
-
} catch (_) {
|
|
7928
|
-
}
|
|
7929
|
-
});
|
|
7930
|
-
}
|
|
7931
|
-
const attributes = getAttributes(root);
|
|
7932
|
+
if (childNodes) arrayForEach(arraySlice(childNodes), (child) => {
|
|
7933
|
+
try {
|
|
7934
|
+
remove(child);
|
|
7935
|
+
} catch (_) {
|
|
7936
|
+
}
|
|
7937
|
+
});
|
|
7938
|
+
const attributes = _readNodeType(root) === NODE_TYPE.element ? getAttributes(root) : null;
|
|
7932
7939
|
if (attributes) for (let i = attributes.length - 1; i >= 0; --i) {
|
|
7933
7940
|
const attribute = attributes[i];
|
|
7934
7941
|
const name = attribute && attribute.name;
|
|
@@ -7975,15 +7982,94 @@ function createDOMPurify() {
|
|
|
7975
7982
|
_stripAttributeNode(element, attribute, name);
|
|
7976
7983
|
}
|
|
7977
7984
|
};
|
|
7978
|
-
const
|
|
7985
|
+
const _walkTree = function _walkTree2(root, visit) {
|
|
7986
|
+
let intoShadow = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
7979
7987
|
const stack = [root];
|
|
7980
7988
|
while (stack.length > 0) {
|
|
7981
7989
|
const node = stack.pop();
|
|
7982
|
-
if (
|
|
7990
|
+
if (visit(node) === false) continue;
|
|
7991
|
+
if (intoShadow && _readNodeType(node) === NODE_TYPE.element) {
|
|
7992
|
+
const shadowRoot = getShadowRoot(node);
|
|
7993
|
+
if (_isDocumentFragment(shadowRoot)) stack.push(shadowRoot);
|
|
7994
|
+
}
|
|
7983
7995
|
const childNodes = getChildNodes(node);
|
|
7984
7996
|
if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push(childNodes[i]);
|
|
7985
7997
|
}
|
|
7986
7998
|
};
|
|
7999
|
+
const _neutralizeSubtree = function _neutralizeSubtree2(root) {
|
|
8000
|
+
_walkTree(root, (node) => {
|
|
8001
|
+
if (_readNodeType(node) === NODE_TYPE.element) _stripDisallowedAttributes(node);
|
|
8002
|
+
});
|
|
8003
|
+
};
|
|
8004
|
+
const _collectLiveNodes = function _collectLiveNodes2(root) {
|
|
8005
|
+
const nodes = [];
|
|
8006
|
+
_walkTree(root, (node) => {
|
|
8007
|
+
nodes.push(node);
|
|
8008
|
+
}, true);
|
|
8009
|
+
return nodes;
|
|
8010
|
+
};
|
|
8011
|
+
const _neutralizeEscapedElements = function _neutralizeEscapedElements2(root, before) {
|
|
8012
|
+
const reachable = setCreate();
|
|
8013
|
+
arrayForEach(_collectLiveNodes(root), (node) => {
|
|
8014
|
+
if (_readNodeType(node) === NODE_TYPE.element) setAdd(reachable, node);
|
|
8015
|
+
});
|
|
8016
|
+
arrayForEach(before, (node) => {
|
|
8017
|
+
if (_readNodeType(node) === NODE_TYPE.element && !setHas(reachable, node)) _stripDisallowedAttributes(node);
|
|
8018
|
+
});
|
|
8019
|
+
};
|
|
8020
|
+
const _neutralizeDiscarded = function _neutralizeDiscarded2(root, before) {
|
|
8021
|
+
let rootRemoved = false;
|
|
8022
|
+
arrayForEach(DOMPurify.removed, (entry) => {
|
|
8023
|
+
if (entry.element) {
|
|
8024
|
+
rootRemoved = rootRemoved || entry.element === root;
|
|
8025
|
+
_neutralizeSubtree(entry.element);
|
|
8026
|
+
}
|
|
8027
|
+
});
|
|
8028
|
+
_neutralizeEscapedElements(root, before);
|
|
8029
|
+
return rootRemoved;
|
|
8030
|
+
};
|
|
8031
|
+
const MAX_UNVISITED_ROUNDS = 8;
|
|
8032
|
+
const _sanitizeUnvisitedNodes = function _sanitizeUnvisitedNodes2(root, before) {
|
|
8033
|
+
const visited = IN_PLACE_VISITED;
|
|
8034
|
+
let original = null;
|
|
8035
|
+
const getOriginal = () => {
|
|
8036
|
+
if (!original) {
|
|
8037
|
+
original = setCreate();
|
|
8038
|
+
arrayForEach(before, (beforeNode) => {
|
|
8039
|
+
setAdd(original, beforeNode);
|
|
8040
|
+
});
|
|
8041
|
+
}
|
|
8042
|
+
return original;
|
|
8043
|
+
};
|
|
8044
|
+
for (let round3 = 0; ; round3++) {
|
|
8045
|
+
const live = _collectLiveNodes(root);
|
|
8046
|
+
const containers = [root];
|
|
8047
|
+
let pending = false;
|
|
8048
|
+
arrayForEach(live, (node) => {
|
|
8049
|
+
if (_readNodeType(node) === NODE_TYPE.documentFragment) arrayPush(containers, node);
|
|
8050
|
+
else if (!pending && !setHas(visited, node)) pending = setHas(getOriginal(), node);
|
|
8051
|
+
});
|
|
8052
|
+
if (!pending) return;
|
|
8053
|
+
if (round3 >= MAX_UNVISITED_ROUNDS) throw typeErrorCreate("the tree kept changing during in-place sanitization; refusing to return it");
|
|
8054
|
+
arrayForEach(containers, (container, index) => {
|
|
8055
|
+
_sanitizeUnvisitedIn(container, index > 0, root, getOriginal());
|
|
8056
|
+
});
|
|
8057
|
+
}
|
|
8058
|
+
};
|
|
8059
|
+
const _sanitizeUnvisitedIn = function _sanitizeUnvisitedIn2(container, inShadow, root, original) {
|
|
8060
|
+
const iterator = _createNodeIterator(container);
|
|
8061
|
+
let node;
|
|
8062
|
+
while (node = iterator.nextNode()) {
|
|
8063
|
+
if (!setHas(original, node) || setHas(IN_PLACE_VISITED, node)) continue;
|
|
8064
|
+
if (inShadow) _executeHooks(hooks.uponSanitizeShadowNode, node, null);
|
|
8065
|
+
_sanitizeElements(node, root);
|
|
8066
|
+
_sanitizeAttributes(node, root);
|
|
8067
|
+
if (_isDocumentFragment(node.content)) _sanitizeShadowDOM2(node.content);
|
|
8068
|
+
}
|
|
8069
|
+
};
|
|
8070
|
+
const _markVisited = function _markVisited2(node) {
|
|
8071
|
+
if (IN_PLACE_VISITED) setAdd(IN_PLACE_VISITED, node);
|
|
8072
|
+
};
|
|
7987
8073
|
const _isPatchLinkageAttribute = function _isPatchLinkageAttribute2(lcName, lcTag) {
|
|
7988
8074
|
if (!SAFE_FOR_XML) return false;
|
|
7989
8075
|
if (lcName === "patchsrc") return true;
|
|
@@ -7991,16 +8077,14 @@ function createDOMPurify() {
|
|
|
7991
8077
|
};
|
|
7992
8078
|
const _neutralizePatchLinkage = function _neutralizePatchLinkage2(root) {
|
|
7993
8079
|
if (!SAFE_FOR_XML) return;
|
|
7994
|
-
|
|
7995
|
-
while (stack.length > 0) {
|
|
7996
|
-
const node = stack.pop();
|
|
8080
|
+
_walkTree(root, (node) => {
|
|
7997
8081
|
const nodeType = _readNodeType(node);
|
|
7998
8082
|
if (nodeType === NODE_TYPE.processingInstruction || nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, node.data)) {
|
|
7999
8083
|
try {
|
|
8000
8084
|
remove(node);
|
|
8001
8085
|
} catch (_) {
|
|
8002
8086
|
}
|
|
8003
|
-
|
|
8087
|
+
return false;
|
|
8004
8088
|
}
|
|
8005
8089
|
if (nodeType === NODE_TYPE.element) {
|
|
8006
8090
|
const element = node;
|
|
@@ -8011,9 +8095,8 @@ function createDOMPurify() {
|
|
|
8011
8095
|
} catch (_) {
|
|
8012
8096
|
}
|
|
8013
8097
|
}
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
}
|
|
8098
|
+
return true;
|
|
8099
|
+
});
|
|
8017
8100
|
};
|
|
8018
8101
|
const _initDocument = function _initDocument2(dirty) {
|
|
8019
8102
|
let doc = null;
|
|
@@ -8053,6 +8136,13 @@ function createDOMPurify() {
|
|
|
8053
8136
|
};
|
|
8054
8137
|
const _scrubTemplateExpressions2 = function _scrubTemplateExpressions(node) {
|
|
8055
8138
|
var _node$querySelectorAl;
|
|
8139
|
+
_scrubOwnCharacterData(node);
|
|
8140
|
+
const templates = (_node$querySelectorAl = node.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node, "template");
|
|
8141
|
+
if (templates) arrayForEach(templates, (tmpl) => {
|
|
8142
|
+
if (_isDocumentFragment(tmpl.content)) _scrubTemplateExpressions2(tmpl.content);
|
|
8143
|
+
});
|
|
8144
|
+
};
|
|
8145
|
+
const _scrubOwnCharacterData = function _scrubOwnCharacterData2(node) {
|
|
8056
8146
|
node.normalize();
|
|
8057
8147
|
const doc = getOwnerDocument ? getOwnerDocument(node) : node.ownerDocument;
|
|
8058
8148
|
const walker = createNodeIterator.call(doc || node, node, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION, null);
|
|
@@ -8061,10 +8151,6 @@ function createDOMPurify() {
|
|
|
8061
8151
|
currentNode.data = _stripTemplateExpressions(currentNode.data);
|
|
8062
8152
|
currentNode = walker.nextNode();
|
|
8063
8153
|
}
|
|
8064
|
-
const templates = (_node$querySelectorAl = node.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node, "template");
|
|
8065
|
-
if (templates) arrayForEach(templates, (tmpl) => {
|
|
8066
|
-
if (_isDocumentFragment(tmpl.content)) _scrubTemplateExpressions2(tmpl.content);
|
|
8067
|
-
});
|
|
8068
8154
|
};
|
|
8069
8155
|
const _isClobbered = function _isClobbered2(element) {
|
|
8070
8156
|
const realTagName = getNodeName ? getNodeName(element) : null;
|
|
@@ -8096,7 +8182,7 @@ function createDOMPurify() {
|
|
|
8096
8182
|
}
|
|
8097
8183
|
const _isUnsafeNode = function _isUnsafeNode2(currentNode, tagName) {
|
|
8098
8184
|
if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) return true;
|
|
8099
|
-
if (SAFE_FOR_XML && currentNode
|
|
8185
|
+
if (SAFE_FOR_XML && LITERAL_TEXT_ELEMENTS[tagName] && _readNodeType(currentNode) === NODE_TYPE.element && _readNamespaceURI(currentNode) === HTML_NAMESPACE && (_isNode(currentNode.firstElementChild) || typeof currentNode.textContent === "string" && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent))) return true;
|
|
8100
8186
|
if (currentNode.nodeType === NODE_TYPE.processingInstruction) return true;
|
|
8101
8187
|
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) return true;
|
|
8102
8188
|
return false;
|
|
@@ -8111,7 +8197,7 @@ function createDOMPurify() {
|
|
|
8111
8197
|
};
|
|
8112
8198
|
const _sanitizeDisallowedNode = function _sanitizeDisallowedNode2(currentNode, tagName, root) {
|
|
8113
8199
|
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
|
|
8114
|
-
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
8200
|
+
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName] && !FORBID_CONTENTS[stringToLowerCase(tagName)]) {
|
|
8115
8201
|
const parentNode = getParentNode(currentNode);
|
|
8116
8202
|
const childNodes = getChildNodes(currentNode);
|
|
8117
8203
|
if (childNodes && parentNode) {
|
|
@@ -8135,6 +8221,7 @@ function createDOMPurify() {
|
|
|
8135
8221
|
return true;
|
|
8136
8222
|
};
|
|
8137
8223
|
const _sanitizeElements = function _sanitizeElements2(currentNode, root) {
|
|
8224
|
+
_markVisited(currentNode);
|
|
8138
8225
|
_executeHooks(hooks.beforeSanitizeElements, currentNode, null);
|
|
8139
8226
|
if (_handleHookDetachedNode(currentNode, root)) return true;
|
|
8140
8227
|
if (_isClobbered(currentNode)) {
|
|
@@ -8228,6 +8315,10 @@ function createDOMPurify() {
|
|
|
8228
8315
|
return false;
|
|
8229
8316
|
}
|
|
8230
8317
|
};
|
|
8318
|
+
const _isUnsafeAttributeValue = function _isUnsafeAttributeValue2(name, value) {
|
|
8319
|
+
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) return true;
|
|
8320
|
+
return stringToLowerCase(name) === "attributename" && stringMatch(value, "href") !== null;
|
|
8321
|
+
};
|
|
8231
8322
|
const _sanitizeAttributes = function _sanitizeAttributes2(currentNode, root) {
|
|
8232
8323
|
_executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
|
|
8233
8324
|
if (_handleHookDetachedNode(currentNode, root)) return;
|
|
@@ -8261,11 +8352,7 @@ function createDOMPurify() {
|
|
|
8261
8352
|
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
8262
8353
|
recreatedNamedProp = true;
|
|
8263
8354
|
}
|
|
8264
|
-
if (
|
|
8265
|
-
_removeAttribute(name, currentNode, attr);
|
|
8266
|
-
continue;
|
|
8267
|
-
}
|
|
8268
|
-
if (lcName === "attributename" && stringMatch(value, "href")) {
|
|
8355
|
+
if (_isUnsafeAttributeValue(name, value)) {
|
|
8269
8356
|
_removeAttribute(name, currentNode, attr);
|
|
8270
8357
|
continue;
|
|
8271
8358
|
}
|
|
@@ -8308,6 +8395,7 @@ function createDOMPurify() {
|
|
|
8308
8395
|
}
|
|
8309
8396
|
}
|
|
8310
8397
|
}
|
|
8398
|
+
if (SAFE_FOR_TEMPLATES) _scrubOwnCharacterData(fragment);
|
|
8311
8399
|
_executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
|
|
8312
8400
|
};
|
|
8313
8401
|
const _sanitizeAttachedShadowRoots = function _sanitizeAttachedShadowRoots2(root) {
|
|
@@ -8371,6 +8459,8 @@ function createDOMPurify() {
|
|
|
8371
8459
|
if (hooks.uponSanitizeAttribute.length > 0) ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
8372
8460
|
DOMPurify.removed = [];
|
|
8373
8461
|
const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
|
|
8462
|
+
let inPlaceNodes = [];
|
|
8463
|
+
const outerVisited = IN_PLACE_VISITED;
|
|
8374
8464
|
if (inPlace) {
|
|
8375
8465
|
_neutralizePatchLinkage(dirty);
|
|
8376
8466
|
const nn = _readNodeName(dirty);
|
|
@@ -8385,12 +8475,8 @@ function createDOMPurify() {
|
|
|
8385
8475
|
_neutralizeRoot(dirty);
|
|
8386
8476
|
throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
|
|
8387
8477
|
}
|
|
8388
|
-
|
|
8389
|
-
|
|
8390
|
-
} catch (error) {
|
|
8391
|
-
_neutralizeRoot(dirty);
|
|
8392
|
-
throw error;
|
|
8393
|
-
}
|
|
8478
|
+
inPlaceNodes = _collectLiveNodes(dirty);
|
|
8479
|
+
IN_PLACE_VISITED = setCreate();
|
|
8394
8480
|
} else if (_isNode(dirty)) {
|
|
8395
8481
|
body = _initDocument("<!---->");
|
|
8396
8482
|
importedNode = body.ownerDocument.importNode(dirty, true);
|
|
@@ -8406,30 +8492,25 @@ function createDOMPurify() {
|
|
|
8406
8492
|
if (body && FORCE_BODY) _forceRemove(body.firstChild);
|
|
8407
8493
|
const walkRoot = inPlace ? dirty : body;
|
|
8408
8494
|
try {
|
|
8495
|
+
if (inPlace) _sanitizeAttachedShadowRoots(dirty);
|
|
8409
8496
|
const nodeIterator = _createNodeIterator(walkRoot);
|
|
8410
8497
|
while (currentNode = nodeIterator.nextNode()) {
|
|
8411
8498
|
_sanitizeElements(currentNode, walkRoot);
|
|
8412
8499
|
_sanitizeAttributes(currentNode, walkRoot);
|
|
8413
8500
|
if (_isDocumentFragment(currentNode.content)) _sanitizeShadowDOM2(currentNode.content);
|
|
8414
8501
|
}
|
|
8502
|
+
if (inPlace) _sanitizeUnvisitedNodes(dirty, inPlaceNodes);
|
|
8415
8503
|
} catch (error) {
|
|
8416
8504
|
if (inPlace) {
|
|
8417
8505
|
_neutralizeRoot(dirty);
|
|
8418
|
-
|
|
8419
|
-
if (entry.element) _neutralizeSubtree(entry.element);
|
|
8420
|
-
});
|
|
8506
|
+
_neutralizeDiscarded(dirty, inPlaceNodes);
|
|
8421
8507
|
}
|
|
8422
8508
|
throw error;
|
|
8509
|
+
} finally {
|
|
8510
|
+
IN_PLACE_VISITED = outerVisited;
|
|
8423
8511
|
}
|
|
8424
8512
|
if (inPlace) {
|
|
8425
|
-
|
|
8426
|
-
arrayForEach(DOMPurify.removed, (entry) => {
|
|
8427
|
-
if (entry.element) {
|
|
8428
|
-
if (entry.element === dirty) rootWasRemoved = true;
|
|
8429
|
-
_neutralizeSubtree(entry.element);
|
|
8430
|
-
}
|
|
8431
|
-
});
|
|
8432
|
-
if (rootWasRemoved) throw typeErrorCreate("a node selected for removal could not be safely returned; refusing to sanitize in place");
|
|
8513
|
+
if (_neutralizeDiscarded(dirty, inPlaceNodes)) throw typeErrorCreate("a node selected for removal could not be safely returned; refusing to sanitize in place");
|
|
8433
8514
|
if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions2(dirty);
|
|
8434
8515
|
return dirty;
|
|
8435
8516
|
}
|
|
@@ -8466,6 +8547,7 @@ function createDOMPurify() {
|
|
|
8466
8547
|
if (!CONFIG) _parseConfig({});
|
|
8467
8548
|
const lcTag = transformCaseFunc(tag2);
|
|
8468
8549
|
const lcName = transformCaseFunc(attr);
|
|
8550
|
+
if (typeof value === "string" && (_isUnsafeAttributeValue(attr, value) || !ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value))) return false;
|
|
8469
8551
|
return _isValidAttribute(lcTag, lcName, value);
|
|
8470
8552
|
};
|
|
8471
8553
|
DOMPurify.addHook = function(entryPoint, hookFunction) {
|
|
@@ -8523,7 +8605,7 @@ function Container(HTMLElement) {
|
|
|
8523
8605
|
super();
|
|
8524
8606
|
const shadow = this.attachShadow({ mode: "open" });
|
|
8525
8607
|
const style = this.ownerDocument.createElement("style");
|
|
8526
|
-
style.textContent = `:host{display:block;min-width:0;font:inherit;color:var(--gramlot-ink,CanvasText)}
|
|
8608
|
+
style.textContent = `:host{box-sizing:border-box;display:block;min-width:0;font:inherit;color:var(--gramlot-ink,CanvasText)}
|
|
8527
8609
|
*,*::before,*::after{box-sizing:border-box}.control-box{min-width:0}slot{display:contents}
|
|
8528
8610
|
::slotted(*){min-width:0;max-width:100%}`;
|
|
8529
8611
|
this.controlBox = this.ownerDocument.createElement("div");
|
|
@@ -24038,6 +24120,7 @@ var Tree = (0, components_exports.defineComponent)({
|
|
|
24038
24120
|
getLabelClass: { dtype: "T", nullable: true, default: null },
|
|
24039
24121
|
getIconClass: { dtype: "T", nullable: true, default: null },
|
|
24040
24122
|
selectedLabelClass: { dtype: "T", default: "", binding: "read" },
|
|
24123
|
+
searchText: { dtype: "T", default: "", binding: "read" },
|
|
24041
24124
|
autoCollapse: { dtype: "B", default: false, binding: "read" },
|
|
24042
24125
|
selectedPath: { dtype: "T", nullable: true, default: null, binding: "twoWay" }
|
|
24043
24126
|
},
|
|
@@ -24054,6 +24137,15 @@ var Tree = (0, components_exports.defineComponent)({
|
|
|
24054
24137
|
#scheduled = false;
|
|
24055
24138
|
#loading = /* @__PURE__ */ new Set();
|
|
24056
24139
|
#errors = /* @__PURE__ */ new Map();
|
|
24140
|
+
#searchInput = "";
|
|
24141
|
+
#searchText = "";
|
|
24142
|
+
#searchTimer = null;
|
|
24143
|
+
#searchVersion = 0;
|
|
24144
|
+
#searchOpen = /* @__PURE__ */ new Set();
|
|
24145
|
+
#searchClosed = /* @__PURE__ */ new WeakSet();
|
|
24146
|
+
#searchAttempted = /* @__PURE__ */ new WeakSet();
|
|
24147
|
+
#searching = false;
|
|
24148
|
+
#resolutions = /* @__PURE__ */ new Map();
|
|
24057
24149
|
constructor() {
|
|
24058
24150
|
super();
|
|
24059
24151
|
this.#sanitizer = purify_default(this.ownerDocument.defaultView);
|
|
@@ -24084,6 +24176,8 @@ var Tree = (0, components_exports.defineComponent)({
|
|
|
24084
24176
|
.branch-icon{mask-image:url("data:image/svg+xml,%3Csvg xmlns='${SVG_NS}' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.7' d='M3 7V4h7l3 3h8v13H3z'/%3E%3C/svg%3E")}
|
|
24085
24177
|
.opened-icon{mask-image:url("data:image/svg+xml,%3Csvg xmlns='${SVG_NS}' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.7' d='M3 19V4h7l3 3h8v3M3 20l3-9h16l-3 9z'/%3E%3C/svg%3E")}
|
|
24086
24178
|
.loading>.row{opacity:.65}.error>.row .caption{text-decoration:underline dotted}
|
|
24179
|
+
mark{background:#ffe493;color:#302300;font-weight:600;border-radius:2px;padding:0 1px}
|
|
24180
|
+
.search-status{padding:4px;color:var(--gramlot-text-secondary,#555);font-size:.9em}
|
|
24087
24181
|
[hidden]{display:none}`;
|
|
24088
24182
|
this.shadowRoot.append(style);
|
|
24089
24183
|
}
|
|
@@ -24108,6 +24202,8 @@ var Tree = (0, components_exports.defineComponent)({
|
|
|
24108
24202
|
if (!(bag instanceof Bag2)) throw new TypeError("tree storepath must resolve to a Bag");
|
|
24109
24203
|
if (bag !== this.#store) {
|
|
24110
24204
|
this.#store = bag;
|
|
24205
|
+
this.#resetSearch();
|
|
24206
|
+
this.#searchText = this.#searchInput.toLowerCase();
|
|
24111
24207
|
this.#expanded.clear();
|
|
24112
24208
|
this.#errors.clear();
|
|
24113
24209
|
this.#requestedPath = void 0;
|
|
@@ -24116,12 +24212,85 @@ var Tree = (0, components_exports.defineComponent)({
|
|
|
24116
24212
|
}
|
|
24117
24213
|
projectAttributes(attrs, adapt) {
|
|
24118
24214
|
const rest = super.projectAttributes(attrs, adapt);
|
|
24215
|
+
const text2 = this.parameters.searchText.trim();
|
|
24216
|
+
if (text2 !== this.#searchInput) {
|
|
24217
|
+
this.#resetSearch();
|
|
24218
|
+
this.#searchInput = text2;
|
|
24219
|
+
if (!text2) this.#searchText = "";
|
|
24220
|
+
else this.#searchTimer = setTimeout(() => {
|
|
24221
|
+
this.#searchTimer = null;
|
|
24222
|
+
this.#searchText = text2.toLowerCase();
|
|
24223
|
+
this.#schedule();
|
|
24224
|
+
}, 200);
|
|
24225
|
+
}
|
|
24119
24226
|
this.#schedule();
|
|
24120
24227
|
return rest;
|
|
24121
24228
|
}
|
|
24122
24229
|
connectedCallback() {
|
|
24230
|
+
if (this.#searchTimer === null) this.#searchText = this.#searchInput.toLowerCase();
|
|
24123
24231
|
this.#schedule();
|
|
24124
24232
|
}
|
|
24233
|
+
disconnectedCallback() {
|
|
24234
|
+
this.#resetSearch();
|
|
24235
|
+
}
|
|
24236
|
+
#resetSearch() {
|
|
24237
|
+
clearTimeout(this.#searchTimer);
|
|
24238
|
+
this.#searchTimer = null;
|
|
24239
|
+
this.#searchVersion++;
|
|
24240
|
+
this.#searching = false;
|
|
24241
|
+
this.#searchAttempted = /* @__PURE__ */ new WeakSet();
|
|
24242
|
+
this.#searchOpen.clear();
|
|
24243
|
+
this.#searchClosed = /* @__PURE__ */ new WeakSet();
|
|
24244
|
+
}
|
|
24245
|
+
#opened(node) {
|
|
24246
|
+
return this.#searchText ? this.#searchOpen.has(node) : this.#expanded.has(node);
|
|
24247
|
+
}
|
|
24248
|
+
async #searchBranches() {
|
|
24249
|
+
const version = this.#searchVersion, store = this.#store;
|
|
24250
|
+
const current = () => this.isConnected && version === this.#searchVersion && store === this.#store;
|
|
24251
|
+
this.#searching = true;
|
|
24252
|
+
const visit = async (bag, ancestors = /* @__PURE__ */ new Set()) => {
|
|
24253
|
+
if (!current()) return;
|
|
24254
|
+
if (ancestors.has(bag)) throw new TypeError("tree requires an acyclic Bag store");
|
|
24255
|
+
const next = new Set(ancestors).add(bag);
|
|
24256
|
+
for (const node of bag.getNodes()) {
|
|
24257
|
+
if (!current()) return;
|
|
24258
|
+
if (node.resolver !== null && node.resolver.expired && !this.#searchAttempted.has(node)) {
|
|
24259
|
+
this.#searchAttempted.add(node);
|
|
24260
|
+
await this.#resolve(node, true);
|
|
24261
|
+
}
|
|
24262
|
+
if (!current()) return;
|
|
24263
|
+
if (node.staticValue instanceof Bag2) await visit(node.staticValue, next);
|
|
24264
|
+
}
|
|
24265
|
+
};
|
|
24266
|
+
try {
|
|
24267
|
+
await visit(store);
|
|
24268
|
+
} finally {
|
|
24269
|
+
if (current()) {
|
|
24270
|
+
this.#searching = false;
|
|
24271
|
+
this.#schedule();
|
|
24272
|
+
}
|
|
24273
|
+
}
|
|
24274
|
+
}
|
|
24275
|
+
#highlight(caption) {
|
|
24276
|
+
const walker = this.ownerDocument.createTreeWalker(caption, 4), texts = [];
|
|
24277
|
+
while (walker.nextNode()) texts.push(walker.currentNode);
|
|
24278
|
+
for (const text2 of texts) {
|
|
24279
|
+
const value = text2.textContent, lower = value.toLowerCase(), fragment = this.ownerDocument.createDocumentFragment();
|
|
24280
|
+
let cursor = 0, start = lower.indexOf(this.#searchText);
|
|
24281
|
+
if (start < 0) continue;
|
|
24282
|
+
while (start >= 0) {
|
|
24283
|
+
fragment.append(value.slice(cursor, start));
|
|
24284
|
+
const mark = this.ownerDocument.createElement("mark");
|
|
24285
|
+
mark.textContent = value.slice(start, start + this.#searchText.length);
|
|
24286
|
+
fragment.append(mark);
|
|
24287
|
+
cursor = start + this.#searchText.length;
|
|
24288
|
+
start = lower.indexOf(this.#searchText, cursor);
|
|
24289
|
+
}
|
|
24290
|
+
fragment.append(value.slice(cursor));
|
|
24291
|
+
text2.replaceWith(fragment);
|
|
24292
|
+
}
|
|
24293
|
+
}
|
|
24125
24294
|
#schedule() {
|
|
24126
24295
|
if (this.#scheduled) return;
|
|
24127
24296
|
this.#scheduled = true;
|
|
@@ -24145,6 +24314,9 @@ var Tree = (0, components_exports.defineComponent)({
|
|
|
24145
24314
|
seen.delete(bag);
|
|
24146
24315
|
};
|
|
24147
24316
|
visit(this.#store, "", []);
|
|
24317
|
+
if (this.#searchText && this.#searchTimer === null && !this.#searching && [...items.values()].some(({ node }) => node.resolver !== null && node.resolver.expired && !this.#searchAttempted.has(node))) {
|
|
24318
|
+
void this.#searchBranches();
|
|
24319
|
+
}
|
|
24148
24320
|
const identities = new Set([...items.values()].map((item) => item.node));
|
|
24149
24321
|
for (const node of this.#expanded) if (!identities.has(node)) this.#expanded.delete(node);
|
|
24150
24322
|
for (const node of this.#errors.keys()) if (!identities.has(node)) this.#errors.delete(node);
|
|
@@ -24268,11 +24440,12 @@ var Tree = (0, components_exports.defineComponent)({
|
|
|
24268
24440
|
});
|
|
24269
24441
|
}
|
|
24270
24442
|
const present = () => {
|
|
24271
|
-
const opened = this.#
|
|
24443
|
+
const opened = this.#opened(node), selected2 = this.#selectedPath === path;
|
|
24272
24444
|
const keywords = { item: node, path, opened, selected: selected2 };
|
|
24273
24445
|
const attribute = this.parameters.labelAttribute;
|
|
24274
24446
|
const label = this.parameters.getLabel !== null ? this.#call("getLabel", keywords) : attribute !== null ? Object.hasOwn(node.attr, attribute) ? node.attr[attribute] : node.label : this.parameters.labelCb !== null ? this.#call("labelCb", keywords) : node.label;
|
|
24275
24447
|
this.#setCaption(caption, label, this.parameters.getLabel !== null || attribute === null && this.parameters.labelCb !== null);
|
|
24448
|
+
if (this.#searchText) this.#highlight(caption);
|
|
24276
24449
|
const labelClass = this.parameters.getLabelClass !== null ? this.#call("getLabelClass", keywords) : node.attr[opened ? "labelClassOpened" : "labelClassClosed"] || node.attr.labelClass || "";
|
|
24277
24450
|
const labelClasses = [...this.#classes(labelClass), ...selected2 ? this.#classes(this.parameters.selectedLabelClass) : []];
|
|
24278
24451
|
caption.className = ["caption", ...labelClasses].join(" ");
|
|
@@ -24297,7 +24470,7 @@ var Tree = (0, components_exports.defineComponent)({
|
|
|
24297
24470
|
};
|
|
24298
24471
|
this.#presentations.set(path, present);
|
|
24299
24472
|
const sync = () => {
|
|
24300
|
-
const opened = this.#
|
|
24473
|
+
const opened = this.#opened(node);
|
|
24301
24474
|
entry.setAttribute("aria-expanded", String(opened));
|
|
24302
24475
|
entry.classList.toggle("opened", opened);
|
|
24303
24476
|
entry.classList.toggle("closed", !opened);
|
|
@@ -24307,9 +24480,15 @@ var Tree = (0, components_exports.defineComponent)({
|
|
|
24307
24480
|
present();
|
|
24308
24481
|
};
|
|
24309
24482
|
const toggle = () => {
|
|
24310
|
-
|
|
24311
|
-
|
|
24312
|
-
|
|
24483
|
+
const expanded = this.#searchText ? this.#searchOpen : this.#expanded;
|
|
24484
|
+
if (expanded.has(node)) {
|
|
24485
|
+
expanded.delete(node);
|
|
24486
|
+
if (this.#searchText) this.#searchClosed.add(node);
|
|
24487
|
+
} else {
|
|
24488
|
+
if (this.#searchText) {
|
|
24489
|
+
this.#searchClosed.delete(node);
|
|
24490
|
+
this.#searchOpen.add(node);
|
|
24491
|
+
} else this.#expand(node);
|
|
24313
24492
|
if (node.resolver !== null) this.#resolve(node);
|
|
24314
24493
|
}
|
|
24315
24494
|
for (const update of branchSync.values()) update();
|
|
@@ -24329,10 +24508,10 @@ var Tree = (0, components_exports.defineComponent)({
|
|
|
24329
24508
|
else if (event.key === "Home") target = visible[0];
|
|
24330
24509
|
else if (event.key === "End") target = visible.at(-1);
|
|
24331
24510
|
else if (event.key === "ArrowRight" && branch) {
|
|
24332
|
-
if (!this.#
|
|
24511
|
+
if (!this.#opened(node)) toggle();
|
|
24333
24512
|
else target = group.firstElementChild;
|
|
24334
24513
|
} else if (event.key === "ArrowLeft") {
|
|
24335
|
-
if (branch && this.#
|
|
24514
|
+
if (branch && this.#opened(node)) toggle();
|
|
24336
24515
|
else target = parent;
|
|
24337
24516
|
} else if (event.key === "Enter" || event.key === " ") this.#select(path);
|
|
24338
24517
|
else return;
|
|
@@ -24349,6 +24528,30 @@ var Tree = (0, components_exports.defineComponent)({
|
|
|
24349
24528
|
return list;
|
|
24350
24529
|
};
|
|
24351
24530
|
this.control.replaceChildren(build(this.#store, "", null));
|
|
24531
|
+
this.control.setAttribute("aria-busy", String(this.#searching));
|
|
24532
|
+
if (this.#searchText) {
|
|
24533
|
+
const visible = /* @__PURE__ */ new Set(), matches = [];
|
|
24534
|
+
this.#searchOpen.clear();
|
|
24535
|
+
for (const [path, row] of this.#rows) {
|
|
24536
|
+
const caption = row.firstElementChild.querySelector(".caption"), item = items.get(path);
|
|
24537
|
+
const match = caption.textContent.toLowerCase().includes(this.#searchText);
|
|
24538
|
+
if (match) matches.push(caption);
|
|
24539
|
+
if (match || this.#errors.has(item.node) || this.#loading.has(item.node)) {
|
|
24540
|
+
visible.add(item.node);
|
|
24541
|
+
for (const ancestor of item.ancestors) {
|
|
24542
|
+
visible.add(ancestor);
|
|
24543
|
+
if (!this.#searchClosed.has(ancestor)) this.#searchOpen.add(ancestor);
|
|
24544
|
+
}
|
|
24545
|
+
}
|
|
24546
|
+
}
|
|
24547
|
+
for (const [path, row] of this.#rows) row.hidden = !visible.has(items.get(path).node);
|
|
24548
|
+
for (const update of branchSync.values()) update();
|
|
24549
|
+
const status = this.ownerDocument.createElement("div");
|
|
24550
|
+
status.className = "search-status";
|
|
24551
|
+
status.setAttribute("role", "status");
|
|
24552
|
+
status.textContent = this.#searching ? "Searching\u2026" : this.#errors.size ? "Some branches could not be searched. Expand them to retry." : matches.length ? "" : "No matches";
|
|
24553
|
+
this.control.append(status);
|
|
24554
|
+
}
|
|
24352
24555
|
this.#tabStop(focused ?? selected);
|
|
24353
24556
|
if (focused) this.#rows.get(focused)?.focus();
|
|
24354
24557
|
}
|
|
@@ -24378,6 +24581,10 @@ var Tree = (0, components_exports.defineComponent)({
|
|
|
24378
24581
|
return [...this.control.querySelectorAll("[role=treeitem]")].filter((row) => !row.closest("[hidden]"));
|
|
24379
24582
|
}
|
|
24380
24583
|
#expand(node) {
|
|
24584
|
+
if (this.#searchText) {
|
|
24585
|
+
this.#searchOpen.add(node);
|
|
24586
|
+
return;
|
|
24587
|
+
}
|
|
24381
24588
|
if (this.parameters.autoCollapse) {
|
|
24382
24589
|
for (const sibling of node.parentBag.getNodes()) {
|
|
24383
24590
|
if (sibling !== node) this.#expanded.delete(sibling);
|
|
@@ -24385,20 +24592,25 @@ var Tree = (0, components_exports.defineComponent)({
|
|
|
24385
24592
|
}
|
|
24386
24593
|
this.#expanded.add(node);
|
|
24387
24594
|
}
|
|
24388
|
-
|
|
24389
|
-
if (this.#
|
|
24595
|
+
#resolve(node, searching = false) {
|
|
24596
|
+
if (this.#resolutions.has(node)) return this.#resolutions.get(node);
|
|
24390
24597
|
this.#loading.add(node);
|
|
24391
24598
|
this.#errors.delete(node);
|
|
24392
24599
|
this.#schedule();
|
|
24393
|
-
|
|
24394
|
-
|
|
24395
|
-
|
|
24396
|
-
|
|
24397
|
-
|
|
24398
|
-
|
|
24399
|
-
|
|
24400
|
-
|
|
24401
|
-
|
|
24600
|
+
const pending = (async () => {
|
|
24601
|
+
try {
|
|
24602
|
+
await Promise.resolve().then(() => node.getValue());
|
|
24603
|
+
} catch (error) {
|
|
24604
|
+
this.#errors.set(node, error);
|
|
24605
|
+
if (!searching) this.#expanded.delete(node);
|
|
24606
|
+
} finally {
|
|
24607
|
+
this.#loading.delete(node);
|
|
24608
|
+
this.#resolutions.delete(node);
|
|
24609
|
+
this.#schedule();
|
|
24610
|
+
}
|
|
24611
|
+
})();
|
|
24612
|
+
this.#resolutions.set(node, pending);
|
|
24613
|
+
return pending;
|
|
24402
24614
|
}
|
|
24403
24615
|
#tabStop(path) {
|
|
24404
24616
|
const visible = this.#visible(), target = typeof path === "string" || path == null ? visible.find((row) => row.dataset.path === path) ?? visible[0] : path;
|