@knime/kds-components 10.1.0 → 11.0.0
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/CHANGELOG.md +37 -0
- package/dist/index.css +56 -42
- package/dist/index.js +438 -158
- package/dist/index.js.map +1 -1
- package/dist/src/components/forms/ToggleSwitch/KdsToggleSwitch.vue.d.ts.map +1 -1
- package/dist/src/components/forms/ToggleSwitch/enums.d.ts +2 -1
- package/dist/src/components/forms/ToggleSwitch/enums.d.ts.map +1 -1
- package/dist/src/util/index.d.ts +1 -1
- package/dist/src/util/index.d.ts.map +1 -1
- package/dist/src/util/useKdsDarkMode.d.ts +80 -9
- package/dist/src/util/useKdsDarkMode.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as kdsPopoverRole, c as kdsPopoverTypes, i as kdsPopoverPlacements, l as _plugin_vue_export_helper_default, o as kdsPopoverRoles, r as kdsPopoverPlacement, s as kdsPopoverType, t as KdsPopover_default, u as __exportAll$1 } from "./KdsPopover-DBU9xVEK.js";
|
|
2
2
|
import { a as useKdsIsTruncated, i as elementOverflowsHorizontally, n as useIcon, r as vKdsTooltip, t as KdsIcon_default } from "./KdsIcon-XR1PupNA.js";
|
|
3
3
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createPropsRestProxy, createSlots, createTextVNode, createVNode, defineAsyncComponent, defineComponent, effectScope, getCurrentInstance, guardReactiveProps, h, inject, isRef, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onBeforeUpdate, onMounted, onScopeDispose, onUnmounted, openBlock, provide, readonly, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, toRaw, toRef, toRefs, unref, useAttrs, useCssVars, useId, useModel, useSlots, useTemplateRef, vModelText, vShow, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
4
|
-
import { onClickOutside, useElementSize, useEventListener, useLocalStorage, useMousePressed, usePreferredDark, useRafFn, useResizeObserver, useTemplateRefsList, useVirtualList } from "@vueuse/core";
|
|
4
|
+
import { onClickOutside, useElementSize, useEventListener, useLocalStorage, useMousePressed, useMutationObserver, usePreferredDark, useRafFn, useResizeObserver, useTemplateRefsList, useVirtualList } from "@vueuse/core";
|
|
5
5
|
import './index.css';//#region src/components/accessories/Avatar/enums.ts
|
|
6
6
|
var kdsAvatarSize = {
|
|
7
7
|
SMALL: "small",
|
|
@@ -4931,6 +4931,14 @@ var dimension = {
|
|
|
4931
4931
|
variable: "var(--kds-dimension-component-height-0-25x)"
|
|
4932
4932
|
}
|
|
4933
4933
|
},
|
|
4934
|
+
"0.5x": {
|
|
4935
|
+
value: 8,
|
|
4936
|
+
unit: "px",
|
|
4937
|
+
css: {
|
|
4938
|
+
value: "8px",
|
|
4939
|
+
variable: "var(--kds-dimension-component-height-0-5x)"
|
|
4940
|
+
}
|
|
4941
|
+
},
|
|
4934
4942
|
"0.75x": {
|
|
4935
4943
|
value: 12,
|
|
4936
4944
|
unit: "px",
|
|
@@ -5077,6 +5085,14 @@ var dimension = {
|
|
|
5077
5085
|
variable: "var(--kds-dimension-component-width-0-25x)"
|
|
5078
5086
|
}
|
|
5079
5087
|
},
|
|
5088
|
+
"0.5x": {
|
|
5089
|
+
value: 8,
|
|
5090
|
+
unit: "px",
|
|
5091
|
+
css: {
|
|
5092
|
+
value: "8px",
|
|
5093
|
+
variable: "var(--kds-dimension-component-width-0-5x)"
|
|
5094
|
+
}
|
|
5095
|
+
},
|
|
5080
5096
|
"0.75x": {
|
|
5081
5097
|
value: 12,
|
|
5082
5098
|
unit: "px",
|
|
@@ -6985,8 +7001,11 @@ function prettyBytes(number, options) {
|
|
|
6985
7001
|
return applyFixedWidth(result, options.fixedWidth);
|
|
6986
7002
|
}
|
|
6987
7003
|
//#endregion
|
|
6988
|
-
//#region ../../node_modules/.pnpm/dompurify@3.4.
|
|
6989
|
-
/*! @license DOMPurify 3.4.
|
|
7004
|
+
//#region ../../node_modules/.pnpm/dompurify@3.4.16/node_modules/dompurify/dist/purify.es.mjs
|
|
7005
|
+
/*! @license DOMPurify 3.4.16 | (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.16/LICENSE */
|
|
7006
|
+
function _OverloadYield(e, d) {
|
|
7007
|
+
this.v = e, this.k = d;
|
|
7008
|
+
}
|
|
6990
7009
|
function _arrayLikeToArray(r, a) {
|
|
6991
7010
|
(null == a || a > r.length) && (a = r.length);
|
|
6992
7011
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
@@ -6998,12 +7017,14 @@ function _arrayWithHoles(r) {
|
|
|
6998
7017
|
function _iterableToArrayLimit(r, l) {
|
|
6999
7018
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
7000
7019
|
if (null != t) {
|
|
7001
|
-
var e, n, i, u, a = [], f =
|
|
7020
|
+
var e, n, i, u, a = [], f = !0, o = !1;
|
|
7002
7021
|
try {
|
|
7003
|
-
if (i = (t = t.call(r)).next, 0 === l)
|
|
7004
|
-
|
|
7022
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
7023
|
+
if (Object(t) !== t) return;
|
|
7024
|
+
f = !1;
|
|
7025
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
7005
7026
|
} catch (r) {
|
|
7006
|
-
o =
|
|
7027
|
+
o = !0, n = r;
|
|
7007
7028
|
} finally {
|
|
7008
7029
|
try {
|
|
7009
7030
|
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
@@ -7017,6 +7038,7 @@ function _iterableToArrayLimit(r, l) {
|
|
|
7017
7038
|
function _nonIterableRest() {
|
|
7018
7039
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7019
7040
|
}
|
|
7041
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
7020
7042
|
function _slicedToArray(r, e) {
|
|
7021
7043
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
7022
7044
|
}
|
|
@@ -7027,9 +7049,64 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
7027
7049
|
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
7028
7050
|
}
|
|
7029
7051
|
}
|
|
7030
|
-
|
|
7031
|
-
var
|
|
7032
|
-
|
|
7052
|
+
function AsyncGenerator(e) {
|
|
7053
|
+
var t, n;
|
|
7054
|
+
function resume(t, n) {
|
|
7055
|
+
try {
|
|
7056
|
+
var r = e[t](n), o = r.value, u = o instanceof _OverloadYield;
|
|
7057
|
+
Promise.resolve(u ? o.v : o).then(function(n) {
|
|
7058
|
+
if (u) {
|
|
7059
|
+
var i = "return" === t && o.k ? t : "next";
|
|
7060
|
+
if (!o.k || n.done) return resume(i, n);
|
|
7061
|
+
n = e[i](n).value;
|
|
7062
|
+
}
|
|
7063
|
+
settle(!!r.done, n);
|
|
7064
|
+
}, function(e) {
|
|
7065
|
+
resume("throw", e);
|
|
7066
|
+
});
|
|
7067
|
+
} catch (e) {
|
|
7068
|
+
settle(2, e);
|
|
7069
|
+
}
|
|
7070
|
+
}
|
|
7071
|
+
function settle(e, r) {
|
|
7072
|
+
2 === e ? t.reject(r) : t.resolve({
|
|
7073
|
+
value: r,
|
|
7074
|
+
done: e
|
|
7075
|
+
}), (t = t.next) ? resume(t.key, t.arg) : n = null;
|
|
7076
|
+
}
|
|
7077
|
+
this._invoke = function(e, r) {
|
|
7078
|
+
return new Promise(function(o, u) {
|
|
7079
|
+
var i = {
|
|
7080
|
+
key: e,
|
|
7081
|
+
arg: r,
|
|
7082
|
+
resolve: o,
|
|
7083
|
+
reject: u,
|
|
7084
|
+
next: null
|
|
7085
|
+
};
|
|
7086
|
+
n ? n = n.next = i : (t = n = i, resume(e, r));
|
|
7087
|
+
});
|
|
7088
|
+
}, "function" != typeof e.return && (this.return = void 0);
|
|
7089
|
+
}
|
|
7090
|
+
AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function() {
|
|
7091
|
+
return this;
|
|
7092
|
+
}, AsyncGenerator.prototype.next = function(e) {
|
|
7093
|
+
return this._invoke("next", e);
|
|
7094
|
+
}, AsyncGenerator.prototype.throw = function(e) {
|
|
7095
|
+
return this._invoke("throw", e);
|
|
7096
|
+
}, AsyncGenerator.prototype.return = function(e) {
|
|
7097
|
+
return this._invoke("return", e);
|
|
7098
|
+
};
|
|
7099
|
+
var entries = Object.entries;
|
|
7100
|
+
var setPrototypeOf = Object.setPrototypeOf;
|
|
7101
|
+
var isFrozen = Object.isFrozen;
|
|
7102
|
+
var getPrototypeOf = Object.getPrototypeOf;
|
|
7103
|
+
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
7104
|
+
var freeze = Object.freeze;
|
|
7105
|
+
var seal = Object.seal;
|
|
7106
|
+
var create$1 = Object.create;
|
|
7107
|
+
var _ref = typeof Reflect !== "undefined" && Reflect;
|
|
7108
|
+
var apply = _ref.apply;
|
|
7109
|
+
var construct = _ref.construct;
|
|
7033
7110
|
if (!freeze) freeze = function freeze(x) {
|
|
7034
7111
|
return x;
|
|
7035
7112
|
};
|
|
@@ -7045,9 +7122,11 @@ if (!construct) construct = function construct(Func) {
|
|
|
7045
7122
|
return new Func(...args);
|
|
7046
7123
|
};
|
|
7047
7124
|
var arrayForEach = unapply(Array.prototype.forEach);
|
|
7125
|
+
Array.prototype.indexOf;
|
|
7048
7126
|
var arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
|
|
7049
7127
|
var arrayPop = unapply(Array.prototype.pop);
|
|
7050
7128
|
var arrayPush = unapply(Array.prototype.push);
|
|
7129
|
+
Array.prototype.slice;
|
|
7051
7130
|
var arraySplice = unapply(Array.prototype.splice);
|
|
7052
7131
|
var arrayIsArray = Array.isArray;
|
|
7053
7132
|
var stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
@@ -7707,6 +7786,7 @@ var svg = freeze([
|
|
|
7707
7786
|
"patterncontentunits",
|
|
7708
7787
|
"patterntransform",
|
|
7709
7788
|
"patternunits",
|
|
7789
|
+
"pointer-events",
|
|
7710
7790
|
"points",
|
|
7711
7791
|
"preservealpha",
|
|
7712
7792
|
"preserveaspectratio",
|
|
@@ -7761,6 +7841,7 @@ var svg = freeze([
|
|
|
7761
7841
|
"u2",
|
|
7762
7842
|
"unicode",
|
|
7763
7843
|
"values",
|
|
7844
|
+
"vector-effect",
|
|
7764
7845
|
"viewbox",
|
|
7765
7846
|
"visibility",
|
|
7766
7847
|
"version",
|
|
@@ -7874,6 +7955,24 @@ var NODE_TYPE = {
|
|
|
7874
7955
|
documentFragment: 11,
|
|
7875
7956
|
notation: 12
|
|
7876
7957
|
};
|
|
7958
|
+
var LITERAL_TEXT_ELEMENT_NAMES = [
|
|
7959
|
+
"style",
|
|
7960
|
+
"script",
|
|
7961
|
+
"xmp",
|
|
7962
|
+
"iframe",
|
|
7963
|
+
"noembed",
|
|
7964
|
+
"noframes",
|
|
7965
|
+
"plaintext",
|
|
7966
|
+
"noscript"
|
|
7967
|
+
];
|
|
7968
|
+
var LITERAL_TEXT_ELEMENTS = freeze(addToSet({}, LITERAL_TEXT_ELEMENT_NAMES));
|
|
7969
|
+
var LITERAL_TEXT_CLOSE = function() {
|
|
7970
|
+
const map = {};
|
|
7971
|
+
arrayForEach(LITERAL_TEXT_ELEMENT_NAMES, (name) => {
|
|
7972
|
+
map[name] = seal(new RegExp("</" + name + "(?=[\\t\\n\\f\\r />])", "i"));
|
|
7973
|
+
});
|
|
7974
|
+
return freeze(map);
|
|
7975
|
+
}();
|
|
7877
7976
|
var getGlobal = function getGlobal() {
|
|
7878
7977
|
return typeof window === "undefined" ? null : window;
|
|
7879
7978
|
};
|
|
@@ -7933,10 +8032,25 @@ var _createHooksMap = function _createHooksMap() {
|
|
|
7933
8032
|
var _resolveSetOption = function _resolveSetOption(cfg, key, fallback, options) {
|
|
7934
8033
|
return objectHasOwnProperty(cfg, key) && arrayIsArray(cfg[key]) ? addToSet(options.base ? clone(options.base) : {}, cfg[key], options.transform) : fallback;
|
|
7935
8034
|
};
|
|
8035
|
+
/**
|
|
8036
|
+
* Resolve an object-valued configuration option: a prototype-free clone
|
|
8037
|
+
* of cfg[key] when it is an own, truthy object property, else a fresh
|
|
8038
|
+
* fallback built by makeFallback (fresh on every parse, so a previous
|
|
8039
|
+
* parse can never leak state into the next one).
|
|
8040
|
+
*
|
|
8041
|
+
* @param cfg the cloned, prototype-free configuration object
|
|
8042
|
+
* @param key the configuration property to read
|
|
8043
|
+
* @param makeFallback builds the fallback value when the option is absent
|
|
8044
|
+
* @returns the resolved object
|
|
8045
|
+
*/
|
|
8046
|
+
var _resolveObjectOption = function _resolveObjectOption(cfg, key, makeFallback) {
|
|
8047
|
+
const value = objectHasOwnProperty(cfg, key) ? cfg[key] : void 0;
|
|
8048
|
+
return value && typeof value === "object" ? clone(value) : makeFallback();
|
|
8049
|
+
};
|
|
7936
8050
|
function createDOMPurify() {
|
|
7937
8051
|
let window = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
|
|
7938
8052
|
const DOMPurify = (root) => createDOMPurify(root);
|
|
7939
|
-
DOMPurify.version = "3.4.
|
|
8053
|
+
DOMPurify.version = "3.4.16";
|
|
7940
8054
|
DOMPurify.removed = [];
|
|
7941
8055
|
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
7942
8056
|
DOMPurify.isSupported = false;
|
|
@@ -7953,6 +8067,7 @@ function createDOMPurify() {
|
|
|
7953
8067
|
const ElementPrototype = Element.prototype;
|
|
7954
8068
|
const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
|
|
7955
8069
|
const remove = lookupGetter(ElementPrototype, "remove");
|
|
8070
|
+
const removeAttributeNode = lookupGetter(ElementPrototype, "removeAttributeNode");
|
|
7956
8071
|
const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
|
|
7957
8072
|
const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
|
|
7958
8073
|
const getParentNode = lookupGetter(ElementPrototype, "parentNode");
|
|
@@ -7961,6 +8076,12 @@ function createDOMPurify() {
|
|
|
7961
8076
|
const getNodeType = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeType") : null;
|
|
7962
8077
|
const getNodeName = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeName") : null;
|
|
7963
8078
|
const getOwnerDocument = Node && Node.prototype ? lookupGetter(Node.prototype, "ownerDocument") : null;
|
|
8079
|
+
const _readNodeType = function _readNodeType(node) {
|
|
8080
|
+
return getNodeType ? getNodeType(node) : node.nodeType;
|
|
8081
|
+
};
|
|
8082
|
+
const _readNodeName = function _readNodeName(node) {
|
|
8083
|
+
return getNodeName ? getNodeName(node) : node.nodeName;
|
|
8084
|
+
};
|
|
7964
8085
|
if (typeof HTMLTemplateElement === "function") {
|
|
7965
8086
|
const template = document.createElement("template");
|
|
7966
8087
|
if (template.content && template.content.ownerDocument) document = template.content.ownerDocument;
|
|
@@ -8218,9 +8339,9 @@ function createDOMPurify() {
|
|
|
8218
8339
|
IN_PLACE = cfg.IN_PLACE || false;
|
|
8219
8340
|
IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
|
|
8220
8341
|
NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
|
|
8221
|
-
MATHML_TEXT_INTEGRATION_POINTS =
|
|
8222
|
-
HTML_INTEGRATION_POINTS =
|
|
8223
|
-
const customElementHandling =
|
|
8342
|
+
MATHML_TEXT_INTEGRATION_POINTS = _resolveObjectOption(cfg, "MATHML_TEXT_INTEGRATION_POINTS", () => addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS));
|
|
8343
|
+
HTML_INTEGRATION_POINTS = _resolveObjectOption(cfg, "HTML_INTEGRATION_POINTS", () => addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS));
|
|
8344
|
+
const customElementHandling = _resolveObjectOption(cfg, "CUSTOM_ELEMENT_HANDLING", () => create$1(null));
|
|
8224
8345
|
CUSTOM_ELEMENT_HANDLING = create$1(null);
|
|
8225
8346
|
if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
|
|
8226
8347
|
if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
|
|
@@ -8267,11 +8388,6 @@ function createDOMPurify() {
|
|
|
8267
8388
|
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
8268
8389
|
}
|
|
8269
8390
|
}
|
|
8270
|
-
if (objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
|
8271
|
-
if (objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS)) {
|
|
8272
|
-
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
8273
|
-
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
|
8274
|
-
}
|
|
8275
8391
|
if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
|
|
8276
8392
|
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
8277
8393
|
addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
|
|
@@ -8388,6 +8504,32 @@ function createDOMPurify() {
|
|
|
8388
8504
|
}
|
|
8389
8505
|
};
|
|
8390
8506
|
/**
|
|
8507
|
+
* _stripAttributeNode
|
|
8508
|
+
*
|
|
8509
|
+
* Remove a single Attr node case/namespace-exactly on an attribute-teardown
|
|
8510
|
+
* path. Name-based removeAttribute() ASCII-lowercases its lookup key for an
|
|
8511
|
+
* HTML element in an HTML document and so silently misses a case-preserved
|
|
8512
|
+
* handler (e.g. `ONERROR` off an XML/XHTML import) - the same defect
|
|
8513
|
+
* _removeAttribute() was fixed for, which a name-based call would reintroduce
|
|
8514
|
+
* on these IN_PLACE teardown paths. Unlike _removeAttribute this does not
|
|
8515
|
+
* record into DOMPurify.removed: the neutralize passes intentionally do not
|
|
8516
|
+
* book-keep. A clobbered/detached node falls back to best-effort name-based
|
|
8517
|
+
* removal.
|
|
8518
|
+
*
|
|
8519
|
+
* @param element the element to strip the attribute from
|
|
8520
|
+
* @param attribute the Attr node to remove
|
|
8521
|
+
* @param name the attribute's name, for the fallback path
|
|
8522
|
+
*/
|
|
8523
|
+
const _stripAttributeNode = function _stripAttributeNode(element, attribute, name) {
|
|
8524
|
+
try {
|
|
8525
|
+
removeAttributeNode(element, attribute);
|
|
8526
|
+
} catch (_) {
|
|
8527
|
+
try {
|
|
8528
|
+
element.removeAttribute(name);
|
|
8529
|
+
} catch (_) {}
|
|
8530
|
+
}
|
|
8531
|
+
};
|
|
8532
|
+
/**
|
|
8391
8533
|
* _neutralizeRoot
|
|
8392
8534
|
*
|
|
8393
8535
|
* Fail-closed teardown of an in-place root after the sanitize walk aborts
|
|
@@ -8421,30 +8563,45 @@ function createDOMPurify() {
|
|
|
8421
8563
|
if (attributes) for (let i = attributes.length - 1; i >= 0; --i) {
|
|
8422
8564
|
const attribute = attributes[i];
|
|
8423
8565
|
const name = attribute && attribute.name;
|
|
8424
|
-
if (typeof name === "string")
|
|
8425
|
-
root.removeAttribute(name);
|
|
8426
|
-
} catch (_) {}
|
|
8566
|
+
if (typeof name === "string") _stripAttributeNode(root, attribute, name);
|
|
8427
8567
|
}
|
|
8428
8568
|
};
|
|
8429
8569
|
/**
|
|
8430
8570
|
* _removeAttribute
|
|
8431
8571
|
*
|
|
8572
|
+
* Name-based getAttributeNode()/removeAttribute() ASCII-lowercase their
|
|
8573
|
+
* lookup key for HTML elements in an HTML document, so they silently miss an
|
|
8574
|
+
* attribute whose stored qualified name still contains uppercase ASCII
|
|
8575
|
+
* letters. That happens when the node came from a case-preserving source
|
|
8576
|
+
* (an XML/XHTML document imported via importNode(), or createAttributeNS()),
|
|
8577
|
+
* where e.g. `ONERROR` survives the walk: the policy check lowercases to
|
|
8578
|
+
* `onerror` and rejects it, but `removeAttribute('ONERROR')` looks up
|
|
8579
|
+
* `onerror` and finds nothing. Remove the exact Attr node instead, which is
|
|
8580
|
+
* case- and namespace-exact, and fall back to name-based removal only when
|
|
8581
|
+
* the caller could not supply the node.
|
|
8582
|
+
*
|
|
8432
8583
|
* @param name an Attribute name
|
|
8433
8584
|
* @param element a DOM node
|
|
8585
|
+
* @param attr the exact Attr node to remove, when the caller has it
|
|
8434
8586
|
*/
|
|
8435
|
-
const _removeAttribute = function _removeAttribute(name, element) {
|
|
8587
|
+
const _removeAttribute = function _removeAttribute(name, element, attr) {
|
|
8588
|
+
if (!attr) try {
|
|
8589
|
+
attr = element.getAttributeNode(name);
|
|
8590
|
+
} catch (_) {
|
|
8591
|
+
attr = null;
|
|
8592
|
+
}
|
|
8593
|
+
arrayPush(DOMPurify.removed, {
|
|
8594
|
+
attribute: attr || null,
|
|
8595
|
+
from: element
|
|
8596
|
+
});
|
|
8436
8597
|
try {
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
from: element
|
|
8440
|
-
});
|
|
8598
|
+
if (attr) removeAttributeNode(element, attr);
|
|
8599
|
+
else element.removeAttribute(name);
|
|
8441
8600
|
} catch (_) {
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
});
|
|
8601
|
+
try {
|
|
8602
|
+
element.removeAttribute(name);
|
|
8603
|
+
} catch (_) {}
|
|
8446
8604
|
}
|
|
8447
|
-
element.removeAttribute(name);
|
|
8448
8605
|
if (name === "is") if (RETURN_DOM || RETURN_DOM_FRAGMENT) try {
|
|
8449
8606
|
_forceRemove(element);
|
|
8450
8607
|
} catch (_) {}
|
|
@@ -8469,9 +8626,7 @@ function createDOMPurify() {
|
|
|
8469
8626
|
const attribute = attributes[i];
|
|
8470
8627
|
const name = attribute && attribute.name;
|
|
8471
8628
|
if (typeof name !== "string" || ALLOWED_ATTR[transformCaseFunc(name)]) continue;
|
|
8472
|
-
|
|
8473
|
-
element.removeAttribute(name);
|
|
8474
|
-
} catch (_) {}
|
|
8629
|
+
_stripAttributeNode(element, attribute, name);
|
|
8475
8630
|
}
|
|
8476
8631
|
};
|
|
8477
8632
|
/**
|
|
@@ -8500,7 +8655,7 @@ function createDOMPurify() {
|
|
|
8500
8655
|
const stack = [root];
|
|
8501
8656
|
while (stack.length > 0) {
|
|
8502
8657
|
const node = stack.pop();
|
|
8503
|
-
if ((
|
|
8658
|
+
if (_readNodeType(node) === NODE_TYPE.element) _stripDisallowedAttributes(node);
|
|
8504
8659
|
const childNodes = getChildNodes(node);
|
|
8505
8660
|
if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push(childNodes[i]);
|
|
8506
8661
|
}
|
|
@@ -8540,12 +8695,28 @@ function createDOMPurify() {
|
|
|
8540
8695
|
*
|
|
8541
8696
|
* @param root the in-place root to sweep
|
|
8542
8697
|
*/
|
|
8698
|
+
/**
|
|
8699
|
+
* Central policy for declarative-partial-updates patch-linkage attributes,
|
|
8700
|
+
* shared by the _neutralizePatchLinkage pre-pass and _isValidAttribute so
|
|
8701
|
+
* the two sites cannot drift: `patchsrc` always links, `for` links
|
|
8702
|
+
* everywhere except on <label>/<output>, and the whole policy is gated on
|
|
8703
|
+
* SAFE_FOR_XML (see the rationale block in _isValidAttribute).
|
|
8704
|
+
*
|
|
8705
|
+
* @param lcName the transformCaseFunc'd attribute name
|
|
8706
|
+
* @param lcTag the transformCaseFunc'd tag name of the carrying element
|
|
8707
|
+
* @return true if the attribute is patch linkage and must be dropped
|
|
8708
|
+
*/
|
|
8709
|
+
const _isPatchLinkageAttribute = function _isPatchLinkageAttribute(lcName, lcTag) {
|
|
8710
|
+
if (!SAFE_FOR_XML) return false;
|
|
8711
|
+
if (lcName === "patchsrc") return true;
|
|
8712
|
+
return lcName === "for" && lcTag !== "label" && lcTag !== "output";
|
|
8713
|
+
};
|
|
8543
8714
|
const _neutralizePatchLinkage = function _neutralizePatchLinkage(root) {
|
|
8544
8715
|
if (!SAFE_FOR_XML) return;
|
|
8545
8716
|
const stack = [root];
|
|
8546
8717
|
while (stack.length > 0) {
|
|
8547
8718
|
const node = stack.pop();
|
|
8548
|
-
const nodeType =
|
|
8719
|
+
const nodeType = _readNodeType(node);
|
|
8549
8720
|
if (nodeType === NODE_TYPE.processingInstruction || nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, node.data)) {
|
|
8550
8721
|
try {
|
|
8551
8722
|
remove(node);
|
|
@@ -8554,10 +8725,10 @@ function createDOMPurify() {
|
|
|
8554
8725
|
}
|
|
8555
8726
|
if (nodeType === NODE_TYPE.element) {
|
|
8556
8727
|
const element = node;
|
|
8557
|
-
const lcTag = transformCaseFunc(
|
|
8728
|
+
const lcTag = transformCaseFunc(_readNodeName(node));
|
|
8558
8729
|
try {
|
|
8559
8730
|
if (element.hasAttribute && element.hasAttribute("patchsrc")) element.removeAttribute("patchsrc");
|
|
8560
|
-
if (element.hasAttribute && element.hasAttribute("for") &&
|
|
8731
|
+
if (element.hasAttribute && element.hasAttribute("for") && _isPatchLinkageAttribute("for", lcTag)) element.removeAttribute("for");
|
|
8561
8732
|
} catch (_) {}
|
|
8562
8733
|
}
|
|
8563
8734
|
const childNodes = getChildNodes(node);
|
|
@@ -8668,7 +8839,7 @@ function createDOMPurify() {
|
|
|
8668
8839
|
const realTagName = getNodeName ? getNodeName(element) : null;
|
|
8669
8840
|
if (typeof realTagName !== "string") return false;
|
|
8670
8841
|
if (transformCaseFunc(realTagName) !== "form") return false;
|
|
8671
|
-
return typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || element.attributes !== getAttributes(element) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function" || element.nodeType !== getNodeType(element) || element.childNodes !== getChildNodes(element);
|
|
8842
|
+
return typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || element.attributes !== getAttributes(element) || typeof element.removeAttribute !== "function" || typeof element.removeAttributeNode !== "function" || typeof element.getAttributeNode !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function" || element.nodeType !== getNodeType(element) || element.childNodes !== getChildNodes(element);
|
|
8672
8843
|
};
|
|
8673
8844
|
/**
|
|
8674
8845
|
* Checks whether the given value is a DocumentFragment from any realm.
|
|
@@ -8726,12 +8897,32 @@ function createDOMPurify() {
|
|
|
8726
8897
|
*/
|
|
8727
8898
|
const _isUnsafeNode = function _isUnsafeNode(currentNode, tagName) {
|
|
8728
8899
|
if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) return true;
|
|
8729
|
-
if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "
|
|
8900
|
+
if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && LITERAL_TEXT_ELEMENTS[tagName] && (_isNode(currentNode.firstElementChild) || typeof currentNode.textContent === "string" && regExpTest(LITERAL_TEXT_CLOSE[tagName], currentNode.textContent))) return true;
|
|
8730
8901
|
if (currentNode.nodeType === NODE_TYPE.processingInstruction) return true;
|
|
8731
8902
|
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) return true;
|
|
8732
8903
|
return false;
|
|
8733
8904
|
};
|
|
8734
8905
|
/**
|
|
8906
|
+
* Evaluate a CUSTOM_ELEMENT_HANDLING check (a RegExp or a predicate
|
|
8907
|
+
* function, per the validation in _parseConfig) against a name.
|
|
8908
|
+
* Additional arguments are forwarded to predicate functions - the
|
|
8909
|
+
* attributeNameCheck predicate receives the tag name as its second
|
|
8910
|
+
* argument. A null/absent check never matches.
|
|
8911
|
+
*
|
|
8912
|
+
* @param check the configured tagNameCheck / attributeNameCheck value
|
|
8913
|
+
* @param name the name to test
|
|
8914
|
+
* @param args extra arguments forwarded to a predicate function
|
|
8915
|
+
* @return true if the check matches the name
|
|
8916
|
+
*/
|
|
8917
|
+
const _matchesNameCheck = function _matchesNameCheck(check, name) {
|
|
8918
|
+
if (check instanceof RegExp) return regExpTest(check, name);
|
|
8919
|
+
if (check instanceof Function) {
|
|
8920
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) args[_key - 2] = arguments[_key];
|
|
8921
|
+
return Boolean(check(name, ...args));
|
|
8922
|
+
}
|
|
8923
|
+
return false;
|
|
8924
|
+
};
|
|
8925
|
+
/**
|
|
8735
8926
|
* Handle a node whose tag is forbidden or not allowlisted: keep
|
|
8736
8927
|
* allowed custom elements (false return exits _sanitizeElements
|
|
8737
8928
|
* early - the namespace and fallback-tag removal checks are
|
|
@@ -8749,10 +8940,7 @@ function createDOMPurify() {
|
|
|
8749
8940
|
* @return true if the node was removed, false if kept
|
|
8750
8941
|
*/
|
|
8751
8942
|
const _sanitizeDisallowedNode = function _sanitizeDisallowedNode(currentNode, tagName, root) {
|
|
8752
|
-
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName))
|
|
8753
|
-
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
|
|
8754
|
-
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
|
|
8755
|
-
}
|
|
8943
|
+
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
|
|
8756
8944
|
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
8757
8945
|
const parentNode = getParentNode(currentNode);
|
|
8758
8946
|
const childNodes = getChildNodes(currentNode);
|
|
@@ -8786,6 +8974,42 @@ function createDOMPurify() {
|
|
|
8786
8974
|
return set === defaultSet || set === setConfigSet ? clone(set) : set;
|
|
8787
8975
|
};
|
|
8788
8976
|
/**
|
|
8977
|
+
* Shared guard for a node that a hook has detached from the walk tree,
|
|
8978
|
+
* used after each element-hook site in _sanitizeElements. Detaching is a
|
|
8979
|
+
* long-standing user pattern (issue #469; draw.io-style foreignObject
|
|
8980
|
+
* filtering). Per the cached, unclobberable parentNode getter the node is
|
|
8981
|
+
* genuinely out of the tree, so it can reach neither the serialized
|
|
8982
|
+
* output nor an IN_PLACE live tree; treat it as removed and stop
|
|
8983
|
+
* processing it. Without this guard, the unsafe-node / namespace checks
|
|
8984
|
+
* would call _forceRemove on a parentless node and hit the REPORT-3
|
|
8985
|
+
* fail-closed throw — which exists for nodes DOMPurify wants gone but
|
|
8986
|
+
* *cannot* detach (clobbered / parentless roots), the opposite of a node
|
|
8987
|
+
* that is already safely gone. The walk root is exempt: a detached
|
|
8988
|
+
* IN_PLACE root is legitimate input and must still be fully sanitized,
|
|
8989
|
+
* and a kill-decision on it must keep hitting the REPORT-3 throw.
|
|
8990
|
+
*
|
|
8991
|
+
* Nodes detached by hooks stay the hook's responsibility for placement:
|
|
8992
|
+
* they are not recorded in DOMPurify.removed, so the post-walk IN_PLACE
|
|
8993
|
+
* pass (which iterates DOMPurify.removed) does not reach them. But a
|
|
8994
|
+
* hook-detached subtree can still hold a queued resource-event handler -
|
|
8995
|
+
* e.g. an <img onload> that began loading when the caller built the live
|
|
8996
|
+
* tree - which fires in page scope after sanitize returns even though the
|
|
8997
|
+
* handler never reached the returned tree. That is the audit-5 F1 hazard,
|
|
8998
|
+
* and the documented node.remove() hook pattern walks straight into it.
|
|
8999
|
+
* So on the IN_PLACE path we neutralize the detached subtree inline,
|
|
9000
|
+
* stripping its non-allow-listed attributes before returning, exactly as
|
|
9001
|
+
* the post-walk pass does for _forceRemove'd subtrees.
|
|
9002
|
+
*
|
|
9003
|
+
* @param currentNode the node a hook may have detached
|
|
9004
|
+
* @param root the current walk root
|
|
9005
|
+
* @return true if the node is detached and now handled, false otherwise
|
|
9006
|
+
*/
|
|
9007
|
+
const _handleHookDetachedNode = function _handleHookDetachedNode(currentNode, root) {
|
|
9008
|
+
if (currentNode === root || getParentNode(currentNode) !== null) return false;
|
|
9009
|
+
if (IN_PLACE) _neutralizeSubtree(currentNode);
|
|
9010
|
+
return true;
|
|
9011
|
+
};
|
|
9012
|
+
/**
|
|
8789
9013
|
* _sanitizeElements
|
|
8790
9014
|
*
|
|
8791
9015
|
* @protect nodeName
|
|
@@ -8796,34 +9020,31 @@ function createDOMPurify() {
|
|
|
8796
9020
|
*/
|
|
8797
9021
|
const _sanitizeElements = function _sanitizeElements(currentNode, root) {
|
|
8798
9022
|
_executeHooks(hooks.beforeSanitizeElements, currentNode, null);
|
|
8799
|
-
if (currentNode
|
|
8800
|
-
if (IN_PLACE) _neutralizeSubtree(currentNode);
|
|
8801
|
-
return true;
|
|
8802
|
-
}
|
|
9023
|
+
if (_handleHookDetachedNode(currentNode, root)) return true;
|
|
8803
9024
|
if (_isClobbered(currentNode)) {
|
|
8804
9025
|
_forceRemove(currentNode);
|
|
8805
9026
|
return true;
|
|
8806
9027
|
}
|
|
8807
|
-
const tagName = transformCaseFunc(
|
|
9028
|
+
const tagName = transformCaseFunc(_readNodeName(currentNode));
|
|
8808
9029
|
ALLOWED_TAGS = _forkSharedAllowlist(hooks.uponSanitizeElement, ALLOWED_TAGS, DEFAULT_ALLOWED_TAGS, SET_CONFIG_ALLOWED_TAGS);
|
|
8809
9030
|
_executeHooks(hooks.uponSanitizeElement, currentNode, {
|
|
8810
9031
|
tagName,
|
|
8811
9032
|
allowedTags: ALLOWED_TAGS
|
|
8812
9033
|
});
|
|
8813
|
-
if (currentNode
|
|
8814
|
-
if (IN_PLACE) _neutralizeSubtree(currentNode);
|
|
8815
|
-
return true;
|
|
8816
|
-
}
|
|
9034
|
+
if (_handleHookDetachedNode(currentNode, root)) return true;
|
|
8817
9035
|
if (_isUnsafeNode(currentNode, tagName)) {
|
|
8818
9036
|
_forceRemove(currentNode);
|
|
8819
9037
|
return true;
|
|
8820
9038
|
}
|
|
8821
9039
|
if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
|
|
8822
9040
|
const removed = _sanitizeDisallowedNode(currentNode, tagName, root);
|
|
8823
|
-
if (removed === false)
|
|
9041
|
+
if (removed === false) {
|
|
9042
|
+
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
9043
|
+
if (_handleHookDetachedNode(currentNode, root)) return true;
|
|
9044
|
+
}
|
|
8824
9045
|
return removed;
|
|
8825
9046
|
}
|
|
8826
|
-
if ((
|
|
9047
|
+
if (_readNodeType(currentNode) === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
|
|
8827
9048
|
_forceRemove(currentNode);
|
|
8828
9049
|
return true;
|
|
8829
9050
|
}
|
|
@@ -8839,7 +9060,7 @@ function createDOMPurify() {
|
|
|
8839
9060
|
}
|
|
8840
9061
|
}
|
|
8841
9062
|
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
8842
|
-
return
|
|
9063
|
+
return _handleHookDetachedNode(currentNode, root);
|
|
8843
9064
|
};
|
|
8844
9065
|
/**
|
|
8845
9066
|
* _isValidAttribute
|
|
@@ -8851,20 +9072,17 @@ function createDOMPurify() {
|
|
|
8851
9072
|
*/
|
|
8852
9073
|
const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
|
8853
9074
|
if (FORBID_ATTR[lcName]) return false;
|
|
8854
|
-
if (
|
|
8855
|
-
if (SAFE_FOR_XML && lcName === "for" && lcTag !== "label" && lcTag !== "output") return false;
|
|
9075
|
+
if (_isPatchLinkageAttribute(lcName, lcTag)) return false;
|
|
8856
9076
|
if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) return false;
|
|
8857
9077
|
const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
|
|
8858
|
-
if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName));
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
|
|
8864
|
-
|
|
8865
|
-
|
|
8866
|
-
else if (value) return false;
|
|
8867
|
-
return true;
|
|
9078
|
+
if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName)) return true;
|
|
9079
|
+
if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) return true;
|
|
9080
|
+
if (!nameIsPermitted) return _isBasicCustomElement(lcTag) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName, lcTag) || lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value);
|
|
9081
|
+
if (URI_SAFE_ATTRIBUTES[lcName]) return true;
|
|
9082
|
+
if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) return true;
|
|
9083
|
+
if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) return true;
|
|
9084
|
+
if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) return true;
|
|
9085
|
+
return !value;
|
|
8868
9086
|
};
|
|
8869
9087
|
const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, [
|
|
8870
9088
|
"annotation-xml",
|
|
@@ -8909,24 +9127,38 @@ function createDOMPurify() {
|
|
|
8909
9127
|
/**
|
|
8910
9128
|
* Write a modified attribute value back onto the element. On
|
|
8911
9129
|
* success, re-probe for clobbering introduced by the new value and
|
|
8912
|
-
* remove the element when found; otherwise
|
|
8913
|
-
*
|
|
8914
|
-
*
|
|
9130
|
+
* remove the element when found; otherwise, when this writeback is the
|
|
9131
|
+
* recreate half of the SANITIZE_NAMED_PROPS remove-and-recreate, pop the
|
|
9132
|
+
* removal entry that path recorded so it does not show as removed. On
|
|
8915
9133
|
* failure, remove the attribute instead.
|
|
8916
9134
|
*
|
|
9135
|
+
* Returns true only on a clean write (the value was set and the new value
|
|
9136
|
+
* introduced no clobbering). The caller uses that, together with its own
|
|
9137
|
+
* knowledge of whether this attribute pushed a DOMPurify.removed record, to
|
|
9138
|
+
* decide whether to pop that record. The pop must happen ONLY for the
|
|
9139
|
+
* named-prop remove-and-recreate; popping on any other value change (trim,
|
|
9140
|
+
* template scrubbing, Trusted Types) would consume an unrelated _forceRemove
|
|
9141
|
+
* subtree-cleanup record and let that detached subtree keep a live event
|
|
9142
|
+
* handler through the IN_PLACE neutralization pass (SO-001).
|
|
9143
|
+
*
|
|
8917
9144
|
* @param currentNode the element carrying the attribute
|
|
8918
9145
|
* @param name the attribute name as present on the element
|
|
8919
9146
|
* @param namespaceURI the attribute's namespace, if any
|
|
8920
9147
|
* @param value the new attribute value
|
|
9148
|
+
* @return true if the value was written without introducing clobbering
|
|
8921
9149
|
*/
|
|
8922
9150
|
const _setAttributeValue = function _setAttributeValue(currentNode, name, namespaceURI, value) {
|
|
8923
9151
|
try {
|
|
8924
9152
|
if (namespaceURI) currentNode.setAttributeNS(namespaceURI, name, value);
|
|
8925
9153
|
else currentNode.setAttribute(name, value);
|
|
8926
|
-
if (_isClobbered(currentNode))
|
|
8927
|
-
|
|
9154
|
+
if (_isClobbered(currentNode)) {
|
|
9155
|
+
_forceRemove(currentNode);
|
|
9156
|
+
return false;
|
|
9157
|
+
}
|
|
9158
|
+
return true;
|
|
8928
9159
|
} catch (_) {
|
|
8929
9160
|
_removeAttribute(name, currentNode);
|
|
9161
|
+
return false;
|
|
8930
9162
|
}
|
|
8931
9163
|
};
|
|
8932
9164
|
/**
|
|
@@ -8938,9 +9170,11 @@ function createDOMPurify() {
|
|
|
8938
9170
|
* @protect setAttribute
|
|
8939
9171
|
*
|
|
8940
9172
|
* @param currentNode to sanitize
|
|
9173
|
+
* @param root the current walk root
|
|
8941
9174
|
*/
|
|
8942
|
-
const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
|
|
9175
|
+
const _sanitizeAttributes = function _sanitizeAttributes(currentNode, root) {
|
|
8943
9176
|
_executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
|
|
9177
|
+
if (_handleHookDetachedNode(currentNode, root)) return;
|
|
8944
9178
|
const attributes = currentNode.attributes;
|
|
8945
9179
|
if (!attributes || _isClobbered(currentNode)) return;
|
|
8946
9180
|
ALLOWED_ATTR = _forkSharedAllowlist(hooks.uponSanitizeAttribute, ALLOWED_ATTR, DEFAULT_ALLOWED_ATTR, SET_CONFIG_ALLOWED_ATTR);
|
|
@@ -8959,6 +9193,7 @@ function createDOMPurify() {
|
|
|
8959
9193
|
const lcName = transformCaseFunc(name);
|
|
8960
9194
|
const initValue = attrValue;
|
|
8961
9195
|
let value = name === "value" ? initValue : stringTrim(initValue);
|
|
9196
|
+
let recreatedNamedProp = false;
|
|
8962
9197
|
hookEvent.attrName = lcName;
|
|
8963
9198
|
hookEvent.attrValue = value;
|
|
8964
9199
|
hookEvent.keepAttr = true;
|
|
@@ -8966,35 +9201,39 @@ function createDOMPurify() {
|
|
|
8966
9201
|
_executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
|
|
8967
9202
|
value = hookEvent.attrValue;
|
|
8968
9203
|
if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
|
|
8969
|
-
_removeAttribute(name, currentNode);
|
|
9204
|
+
_removeAttribute(name, currentNode, attr);
|
|
8970
9205
|
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
9206
|
+
recreatedNamedProp = true;
|
|
8971
9207
|
}
|
|
8972
9208
|
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
|
|
8973
|
-
_removeAttribute(name, currentNode);
|
|
9209
|
+
_removeAttribute(name, currentNode, attr);
|
|
8974
9210
|
continue;
|
|
8975
9211
|
}
|
|
8976
9212
|
if (lcName === "attributename" && stringMatch(value, "href")) {
|
|
8977
|
-
_removeAttribute(name, currentNode);
|
|
9213
|
+
_removeAttribute(name, currentNode, attr);
|
|
8978
9214
|
continue;
|
|
8979
9215
|
}
|
|
8980
9216
|
if (hookEvent.forceKeepAttr) continue;
|
|
8981
9217
|
if (!hookEvent.keepAttr) {
|
|
8982
|
-
_removeAttribute(name, currentNode);
|
|
9218
|
+
_removeAttribute(name, currentNode, attr);
|
|
8983
9219
|
continue;
|
|
8984
9220
|
}
|
|
8985
9221
|
if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value)) {
|
|
8986
|
-
_removeAttribute(name, currentNode);
|
|
9222
|
+
_removeAttribute(name, currentNode, attr);
|
|
8987
9223
|
continue;
|
|
8988
9224
|
}
|
|
8989
9225
|
if (SAFE_FOR_TEMPLATES) value = _stripTemplateExpressions(value);
|
|
8990
9226
|
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
8991
|
-
_removeAttribute(name, currentNode);
|
|
9227
|
+
_removeAttribute(name, currentNode, attr);
|
|
8992
9228
|
continue;
|
|
8993
9229
|
}
|
|
8994
9230
|
value = _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value);
|
|
8995
|
-
if (value !== initValue)
|
|
9231
|
+
if (value !== initValue) {
|
|
9232
|
+
if (_setAttributeValue(currentNode, name, namespaceURI, value) && recreatedNamedProp) arrayPop(DOMPurify.removed);
|
|
9233
|
+
}
|
|
8996
9234
|
}
|
|
8997
9235
|
_executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
|
|
9236
|
+
_handleHookDetachedNode(currentNode, root);
|
|
8998
9237
|
};
|
|
8999
9238
|
/**
|
|
9000
9239
|
* _sanitizeShadowDOM
|
|
@@ -9008,9 +9247,9 @@ function createDOMPurify() {
|
|
|
9008
9247
|
while (shadowNode = shadowIterator.nextNode()) {
|
|
9009
9248
|
_executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
|
|
9010
9249
|
_sanitizeElements(shadowNode, fragment);
|
|
9011
|
-
_sanitizeAttributes(shadowNode);
|
|
9250
|
+
_sanitizeAttributes(shadowNode, fragment);
|
|
9012
9251
|
if (_isDocumentFragment(shadowNode.content)) _sanitizeShadowDOM2(shadowNode.content);
|
|
9013
|
-
if ((
|
|
9252
|
+
if (_readNodeType(shadowNode) === NODE_TYPE.element) {
|
|
9014
9253
|
const innerSr = getShadowRoot(shadowNode);
|
|
9015
9254
|
if (_isDocumentFragment(innerSr)) {
|
|
9016
9255
|
_sanitizeAttachedShadowRoots(innerSr);
|
|
@@ -9051,7 +9290,7 @@ function createDOMPurify() {
|
|
|
9051
9290
|
continue;
|
|
9052
9291
|
}
|
|
9053
9292
|
const node = item.node;
|
|
9054
|
-
const isElement = (
|
|
9293
|
+
const isElement = _readNodeType(node) === NODE_TYPE.element;
|
|
9055
9294
|
const childNodes = getChildNodes(node);
|
|
9056
9295
|
if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push({
|
|
9057
9296
|
node: childNodes[i],
|
|
@@ -9102,7 +9341,7 @@ function createDOMPurify() {
|
|
|
9102
9341
|
const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
|
|
9103
9342
|
if (inPlace) {
|
|
9104
9343
|
_neutralizePatchLinkage(dirty);
|
|
9105
|
-
const nn =
|
|
9344
|
+
const nn = _readNodeName(dirty);
|
|
9106
9345
|
if (typeof nn === "string") {
|
|
9107
9346
|
const tagName = transformCaseFunc(nn);
|
|
9108
9347
|
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
@@ -9126,7 +9365,7 @@ function createDOMPurify() {
|
|
|
9126
9365
|
if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") body = importedNode;
|
|
9127
9366
|
else if (importedNode.nodeName === "HTML") body = importedNode;
|
|
9128
9367
|
else body.appendChild(importedNode);
|
|
9129
|
-
_sanitizeAttachedShadowRoots(
|
|
9368
|
+
_sanitizeAttachedShadowRoots(body);
|
|
9130
9369
|
} else {
|
|
9131
9370
|
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf("<") === -1) return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
|
|
9132
9371
|
body = _initDocument(dirty);
|
|
@@ -9138,7 +9377,7 @@ function createDOMPurify() {
|
|
|
9138
9377
|
const nodeIterator = _createNodeIterator(walkRoot);
|
|
9139
9378
|
while (currentNode = nodeIterator.nextNode()) {
|
|
9140
9379
|
_sanitizeElements(currentNode, walkRoot);
|
|
9141
|
-
_sanitizeAttributes(currentNode);
|
|
9380
|
+
_sanitizeAttributes(currentNode, walkRoot);
|
|
9142
9381
|
if (_isDocumentFragment(currentNode.content)) _sanitizeShadowDOM2(currentNode.content);
|
|
9143
9382
|
}
|
|
9144
9383
|
} catch (error) {
|
|
@@ -9151,9 +9390,14 @@ function createDOMPurify() {
|
|
|
9151
9390
|
throw error;
|
|
9152
9391
|
}
|
|
9153
9392
|
if (inPlace) {
|
|
9393
|
+
let rootWasRemoved = false;
|
|
9154
9394
|
arrayForEach(DOMPurify.removed, (entry) => {
|
|
9155
|
-
if (entry.element)
|
|
9395
|
+
if (entry.element) {
|
|
9396
|
+
if (entry.element === dirty) rootWasRemoved = true;
|
|
9397
|
+
_neutralizeSubtree(entry.element);
|
|
9398
|
+
}
|
|
9156
9399
|
});
|
|
9400
|
+
if (rootWasRemoved) throw typeErrorCreate("a node selected for removal could not be safely returned; refusing to sanitize in place");
|
|
9157
9401
|
if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions2(dirty);
|
|
9158
9402
|
return dirty;
|
|
9159
9403
|
}
|
|
@@ -14929,6 +15173,7 @@ var kdsCheckboxValues = Object.values(kdsCheckboxValue);
|
|
|
14929
15173
|
//#endregion
|
|
14930
15174
|
//#region src/components/forms/ToggleSwitch/enums.ts
|
|
14931
15175
|
var kdsToggleSwitchSize = {
|
|
15176
|
+
XSMALL: "xsmall",
|
|
14932
15177
|
SMALL: "small",
|
|
14933
15178
|
MEDIUM: "medium"
|
|
14934
15179
|
};
|
|
@@ -15004,13 +15249,14 @@ var KdsToggleSwitch_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
15004
15249
|
type: "button",
|
|
15005
15250
|
role: "switch",
|
|
15006
15251
|
onClick: handleClick
|
|
15007
|
-
}, [createElementVNode("div", _hoisted_2$29, [createElementVNode("div", _hoisted_3$23, [
|
|
15252
|
+
}, [createElementVNode("div", _hoisted_2$29, [createElementVNode("div", _hoisted_3$23, [__props.size !== unref(kdsToggleSwitchSize).XSMALL ? (openBlock(), createBlock(KdsIcon_default, {
|
|
15253
|
+
key: 0,
|
|
15008
15254
|
name: isChecked.value ? "checkmark" : "x-close",
|
|
15009
15255
|
size: __props.size === "small" ? "xsmall" : "small"
|
|
15010
|
-
}, null, 8, ["name", "size"])])]), props.label ? (openBlock(), createElementBlock("div", _hoisted_4$21, [createElementVNode("span", _hoisted_5$13, toDisplayString(props.label), 1)])) : createCommentVNode("", true)], 10, _hoisted_1$49);
|
|
15256
|
+
}, null, 8, ["name", "size"])) : createCommentVNode("", true)])]), props.label ? (openBlock(), createElementBlock("div", _hoisted_4$21, [createElementVNode("span", _hoisted_5$13, toDisplayString(props.label), 1)])) : createCommentVNode("", true)], 10, _hoisted_1$49);
|
|
15011
15257
|
};
|
|
15012
15258
|
}
|
|
15013
|
-
}), [["__scopeId", "data-v-
|
|
15259
|
+
}), [["__scopeId", "data-v-1f2d16a6"]]);
|
|
15014
15260
|
//#endregion
|
|
15015
15261
|
//#region src/components/forms/RadioButton/KdsRadioButton.vue?vue&type=script&setup=true&lang.ts
|
|
15016
15262
|
var _hoisted_1$48 = [
|
|
@@ -33516,7 +33762,7 @@ var KdsFileExplorer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
33516
33762
|
"renameFile"
|
|
33517
33763
|
], ["update:activeRenamedItemId"]),
|
|
33518
33764
|
setup(__props, { emit: __emit }) {
|
|
33519
|
-
useCssVars((_ctx) => ({ "
|
|
33765
|
+
useCssVars((_ctx) => ({ "v2bc72e90": itemHeight.value + "px" }));
|
|
33520
33766
|
const props = __props;
|
|
33521
33767
|
/** The id of the item currently being renamed. */
|
|
33522
33768
|
const activeRenamedItemId = useModel(__props, "activeRenamedItemId");
|
|
@@ -33740,15 +33986,15 @@ var KdsFileExplorer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
33740
33986
|
const slots = useSlots();
|
|
33741
33987
|
const dynamicColumnSlotNames = computed(() => Object.keys(slots).filter((key) => key.startsWith("dynamicColumn")));
|
|
33742
33988
|
return (_ctx, _cache) => {
|
|
33743
|
-
return openBlock(), createElementBlock("div", _hoisted_1$15, [
|
|
33744
|
-
|
|
33745
|
-
|
|
33746
|
-
|
|
33747
|
-
|
|
33748
|
-
|
|
33749
|
-
|
|
33750
|
-
|
|
33751
|
-
createElementVNode("tbody", null, [!__props.isRootFolder ? (openBlock(), createBlock(FileExplorerItemBack_default, {
|
|
33989
|
+
return openBlock(), createElementBlock("div", _hoisted_1$15, [
|
|
33990
|
+
createElementVNode("table", mergeProps({
|
|
33991
|
+
tabindex: "0",
|
|
33992
|
+
class: ["scroll-container", { "keyboard-focus": unref(keyPressedUntilMouseClick) }],
|
|
33993
|
+
"aria-label": "list of files in the current folder"
|
|
33994
|
+
}, unref(containerProps), {
|
|
33995
|
+
onFocus: handleFocusOnTable,
|
|
33996
|
+
onKeydown: _cache[11] || (_cache[11] = (...args) => unref(handleKeyboardNavigation) && unref(handleKeyboardNavigation)(...args))
|
|
33997
|
+
}), [createElementVNode("tbody", null, [!__props.isRootFolder ? (openBlock(), createBlock(FileExplorerItemBack_default, {
|
|
33752
33998
|
key: 0,
|
|
33753
33999
|
ref_key: "itemBack",
|
|
33754
34000
|
ref: itemBack,
|
|
@@ -33765,8 +34011,7 @@ var KdsFileExplorer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
33765
34011
|
"class",
|
|
33766
34012
|
"is-dragging",
|
|
33767
34013
|
"onDragover"
|
|
33768
|
-
])) : createCommentVNode("", true)]),
|
|
33769
|
-
createElementVNode("tbody", normalizeProps(guardReactiveProps(unref(wrapperProps))), [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(list), ({ data: item, index }) => {
|
|
34014
|
+
])) : createCommentVNode("", true)]), createElementVNode("tbody", normalizeProps(guardReactiveProps(unref(wrapperProps))), [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(list), ({ data: item, index }) => {
|
|
33770
34015
|
return openBlock(), createBlock(FileExplorerItem_default, {
|
|
33771
34016
|
key: item.id,
|
|
33772
34017
|
ref_for: true,
|
|
@@ -33846,7 +34091,7 @@ var KdsFileExplorer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
33846
34091
|
"onDrop",
|
|
33847
34092
|
"onDblclick"
|
|
33848
34093
|
]);
|
|
33849
|
-
}), 128)), __props.items.length === 0 ? (openBlock(), createElementBlock("tr", _hoisted_2$11, [createElementVNode("td", null, [createVNode(KdsEmptyState_default, mergeProps({ headline: __props.emptyState?.headline ?? "Folder is empty" }, __props.emptyState), null, 16, ["headline"])])])) : createCommentVNode("", true)], 16),
|
|
34094
|
+
}), 128)), __props.items.length === 0 ? (openBlock(), createElementBlock("tr", _hoisted_2$11, [createElementVNode("td", null, [createVNode(KdsEmptyState_default, mergeProps({ headline: __props.emptyState?.headline ?? "Folder is empty" }, __props.emptyState), null, 16, ["headline"])])])) : createCommentVNode("", true)], 16)], 16),
|
|
33850
34095
|
__props.draggingAnimationMode !== "disabled" ? (openBlock(), createElementBlock("div", {
|
|
33851
34096
|
key: 0,
|
|
33852
34097
|
ref_key: "customPreviewContainer",
|
|
@@ -33855,32 +34100,33 @@ var KdsFileExplorer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
33855
34100
|
}, [renderSlot(_ctx.$slots, "customDragPreview", {}, () => [createElementVNode("div", {
|
|
33856
34101
|
ref_key: "customDragPreviewPlaceholder",
|
|
33857
34102
|
ref: customDragPreviewPlaceholder
|
|
33858
|
-
}, null, 512)], true)], 512)) : createCommentVNode("", true)
|
|
33859
|
-
|
|
33860
|
-
|
|
33861
|
-
|
|
33862
|
-
|
|
33863
|
-
|
|
33864
|
-
|
|
33865
|
-
|
|
33866
|
-
|
|
33867
|
-
|
|
33868
|
-
|
|
33869
|
-
|
|
33870
|
-
|
|
33871
|
-
|
|
33872
|
-
|
|
33873
|
-
|
|
33874
|
-
|
|
33875
|
-
|
|
33876
|
-
|
|
33877
|
-
|
|
33878
|
-
|
|
33879
|
-
|
|
33880
|
-
|
|
34103
|
+
}, null, 512)], true)], 512)) : createCommentVNode("", true),
|
|
34104
|
+
createVNode(KdsPopover_default, {
|
|
34105
|
+
ref_key: "popover",
|
|
34106
|
+
ref: popover,
|
|
34107
|
+
"popover-type": "manual",
|
|
34108
|
+
"model-value": Boolean(contextMenuAnchor.value && contextMenuItems.value.length > 0),
|
|
34109
|
+
placement: "bottom-left",
|
|
34110
|
+
"aria-label": "Menu",
|
|
34111
|
+
onKeydown: _cache[14] || (_cache[14] = withKeys(withModifiers(($event) => closeContextMenu(), ["stop", "prevent"]), ["esc"])),
|
|
34112
|
+
onFocusout: _cache[15] || (_cache[15] = ($event) => closeContextMenu())
|
|
34113
|
+
}, {
|
|
34114
|
+
default: withCtx(() => [createVNode(unref(KdsMenuContainer_default), {
|
|
34115
|
+
id: "file-explorer-options-menu",
|
|
34116
|
+
ref_key: "contextMenu",
|
|
34117
|
+
ref: contextMenu,
|
|
34118
|
+
ariaLabel: "File explorer context",
|
|
34119
|
+
items: contextMenuItems.value,
|
|
34120
|
+
"menu-max-height": __props.maxContextMenuHeight,
|
|
34121
|
+
onItemClick: _cache[12] || (_cache[12] = ($event) => closeContextMenu()),
|
|
34122
|
+
onContextmenu: _cache[13] || (_cache[13] = withModifiers(() => {}, ["prevent", "stop"]))
|
|
34123
|
+
}, null, 8, ["items", "menu-max-height"])]),
|
|
34124
|
+
_: 1
|
|
34125
|
+
}, 8, ["model-value"])
|
|
34126
|
+
]);
|
|
33881
34127
|
};
|
|
33882
34128
|
}
|
|
33883
|
-
}), [["__scopeId", "data-v-
|
|
34129
|
+
}), [["__scopeId", "data-v-d13e0460"]]);
|
|
33884
34130
|
//#endregion
|
|
33885
34131
|
//#region src/layouts/explorer/FileExplorer/enums.ts
|
|
33886
34132
|
var kdsFileExplorerSize = {
|
|
@@ -36240,8 +36486,8 @@ var KDS_DARK_MODE_STORAGE_KEY = "KNIME_DARK_MODE";
|
|
|
36240
36486
|
/**
|
|
36241
36487
|
* Key an earlier implementation used to persist the *derived* light/dark state
|
|
36242
36488
|
* alongside the preference. Nothing reads or writes it any more — see
|
|
36243
|
-
* {@link
|
|
36244
|
-
* lingering in browsers that ran that version.
|
|
36489
|
+
* {@link createKdsDarkModeController} — so it is cleared once to stop a stale
|
|
36490
|
+
* value from lingering in browsers that ran that version.
|
|
36245
36491
|
*/
|
|
36246
36492
|
var OBSOLETE_EFFECTIVE_STORAGE_KEY = `${KDS_DARK_MODE_STORAGE_KEY}_EFFECTIVE`;
|
|
36247
36493
|
var defaultMode = kdsDarkModeType.SYSTEM;
|
|
@@ -36269,8 +36515,44 @@ var clearObsoleteEffectiveMode = () => {
|
|
|
36269
36515
|
} catch {}
|
|
36270
36516
|
};
|
|
36271
36517
|
/**
|
|
36518
|
+
* Reads the `color-scheme` of `<html>`, which the `light-dark()` color tokens
|
|
36519
|
+
* resolve against, so it reports what the page renders, whoever themes it: the
|
|
36520
|
+
* app's CSS, `useKdsDarkModeController()` or an embedder.
|
|
36521
|
+
*/
|
|
36522
|
+
var createReadOnlyKdsDarkMode = () => {
|
|
36523
|
+
const documentElement = globalThis.document?.documentElement;
|
|
36524
|
+
const readColorScheme = () => documentElement ? getComputedStyle(documentElement).colorScheme : "normal";
|
|
36525
|
+
const colorScheme = ref(readColorScheme());
|
|
36526
|
+
const update = () => {
|
|
36527
|
+
colorScheme.value = readColorScheme();
|
|
36528
|
+
};
|
|
36529
|
+
useMutationObserver(documentElement, update, { attributeFilter: [
|
|
36530
|
+
"style",
|
|
36531
|
+
"class",
|
|
36532
|
+
"data-theme"
|
|
36533
|
+
] });
|
|
36534
|
+
const systemPrefersDark = usePreferredDark();
|
|
36535
|
+
watch(systemPrefersDark, update);
|
|
36536
|
+
const isDark = computed(() => {
|
|
36537
|
+
const schemes = colorScheme.value.split(" ");
|
|
36538
|
+
return schemes.includes("dark") && (!schemes.includes("light") || systemPrefersDark.value);
|
|
36539
|
+
});
|
|
36540
|
+
const isLight = computed(() => !isDark.value);
|
|
36541
|
+
const lightDark = (color) => isDark.value ? color.dark : color.light;
|
|
36542
|
+
return {
|
|
36543
|
+
/** Whether the page renders dark right now. */
|
|
36544
|
+
isDark,
|
|
36545
|
+
/** Whether the page renders light right now. */
|
|
36546
|
+
isLight,
|
|
36547
|
+
/**
|
|
36548
|
+
* Helper function that turns a KdsColor into the correct KdsColorValue (light or dark)
|
|
36549
|
+
*/
|
|
36550
|
+
lightDark
|
|
36551
|
+
};
|
|
36552
|
+
};
|
|
36553
|
+
/**
|
|
36272
36554
|
* The user preference is the *only* persisted state; the effective light/dark
|
|
36273
|
-
* value is
|
|
36555
|
+
* value is read from the page, which the preference is applied to.
|
|
36274
36556
|
*
|
|
36275
36557
|
* Persisting the derived value as well (as an earlier implementation did) gave
|
|
36276
36558
|
* the same fact two storage keys that could disagree. Every instance wrote the
|
|
@@ -36282,18 +36564,15 @@ var clearObsoleteEffectiveMode = () => {
|
|
|
36282
36564
|
* feedback edge entirely: nothing writes unless the user changes the
|
|
36283
36565
|
* preference.
|
|
36284
36566
|
*/
|
|
36285
|
-
var
|
|
36567
|
+
var createKdsDarkModeController = (page) => {
|
|
36286
36568
|
const userPreference = useLocalStorage(KDS_DARK_MODE_STORAGE_KEY, defaultMode);
|
|
36287
|
-
|
|
36569
|
+
watch(userPreference, applyToDocument, { immediate: true });
|
|
36288
36570
|
const isDark = computed({
|
|
36289
|
-
get()
|
|
36290
|
-
return userPreference.value === kdsDarkModeType.SYSTEM ? systemPrefersDark.value : userPreference.value === kdsDarkModeType.DARK;
|
|
36291
|
-
},
|
|
36571
|
+
get: () => page.isDark.value,
|
|
36292
36572
|
set(value) {
|
|
36293
36573
|
userPreference.value = value ? kdsDarkModeType.DARK : kdsDarkModeType.LIGHT;
|
|
36294
36574
|
}
|
|
36295
36575
|
});
|
|
36296
|
-
watch(userPreference, applyToDocument, { immediate: true });
|
|
36297
36576
|
const preferredMode = computed({
|
|
36298
36577
|
get() {
|
|
36299
36578
|
return userPreference.value;
|
|
@@ -36305,9 +36584,8 @@ var createKdsDarkMode = () => {
|
|
|
36305
36584
|
const isDarkPreferred = computed(() => userPreference.value === kdsDarkModeType.DARK);
|
|
36306
36585
|
const isLightPreferred = computed(() => userPreference.value === kdsDarkModeType.LIGHT);
|
|
36307
36586
|
const isSystemPreferred = computed(() => userPreference.value === kdsDarkModeType.SYSTEM);
|
|
36308
|
-
const isLight = computed(() => !isDark.value);
|
|
36309
|
-
const lightDark = (color) => isDark.value ? color.dark : color.light;
|
|
36310
36587
|
return {
|
|
36588
|
+
...page,
|
|
36311
36589
|
/**
|
|
36312
36590
|
* The current user *preference* (`'light' | 'dark' | 'system'`) as a
|
|
36313
36591
|
* writable computed — use it to read the preference or set it, e.g. via a
|
|
@@ -36321,34 +36599,36 @@ var createKdsDarkMode = () => {
|
|
|
36321
36599
|
/** Whether the user *preference* is set to 'system'. */
|
|
36322
36600
|
isSystemPreferred,
|
|
36323
36601
|
/**
|
|
36324
|
-
* Whether
|
|
36325
|
-
* `
|
|
36326
|
-
* reflects what is actually rendered. Use it for JS/canvas theming (e.g.
|
|
36327
|
-
* charts) that cannot rely on CSS `light-dark()`. Writable: setting it
|
|
36328
|
-
* stores an explicit `'light'`/`'dark'` preference.
|
|
36602
|
+
* Whether the page renders dark right now. Writable: setting it stores an
|
|
36603
|
+
* explicit `'light'`/`'dark'` preference.
|
|
36329
36604
|
*/
|
|
36330
|
-
isDark
|
|
36331
|
-
/**
|
|
36332
|
-
* Whether light styling is effectively active right now (the complement of
|
|
36333
|
-
* `isDark`). Like `isDark`, this resolves 'system' against the OS
|
|
36334
|
-
* preference, unlike the preference-only `isLightPreferred`.
|
|
36335
|
-
*/
|
|
36336
|
-
isLight,
|
|
36337
|
-
/**
|
|
36338
|
-
* Helper function that turns a KdsColor into the correct KdsColorValue (light or dark)
|
|
36339
|
-
*/
|
|
36340
|
-
lightDark
|
|
36605
|
+
isDark
|
|
36341
36606
|
};
|
|
36342
36607
|
};
|
|
36608
|
+
var sharedReadOnly;
|
|
36343
36609
|
var shared;
|
|
36610
|
+
/**
|
|
36611
|
+
* Reports whether the page renders dark and changes nothing, so the app or
|
|
36612
|
+
* embedder that themes the page stays in charge. Use it in components that
|
|
36613
|
+
* theme something CSS cannot reach, such as a Monaco editor or a chart.
|
|
36614
|
+
*/
|
|
36344
36615
|
var useKdsDarkMode = () => {
|
|
36616
|
+
sharedReadOnly ??= effectScope(true).run(createReadOnlyKdsDarkMode);
|
|
36617
|
+
return sharedReadOnly;
|
|
36618
|
+
};
|
|
36619
|
+
/**
|
|
36620
|
+
* Applies the stored preference to the page and exposes it, e.g. for a mode
|
|
36621
|
+
* picker. Only the app that lets KDS own its theme calls it.
|
|
36622
|
+
*/
|
|
36623
|
+
var useKdsDarkModeController = () => {
|
|
36345
36624
|
if (!shared) {
|
|
36346
36625
|
clearObsoleteEffectiveMode();
|
|
36347
|
-
|
|
36626
|
+
const page = useKdsDarkMode();
|
|
36627
|
+
shared = effectScope(true).run(() => createKdsDarkModeController(page));
|
|
36348
36628
|
}
|
|
36349
36629
|
return shared;
|
|
36350
36630
|
};
|
|
36351
36631
|
//#endregion
|
|
36352
|
-
export { KdsAccordion_default as KdsAccordion, KdsAvatar_default as KdsAvatar, KdsAvatarCounter_default as KdsAvatarCounter, KdsBadge_default as KdsBadge, KdsBanner_default as KdsBanner, KdsBreadcrumb_default as KdsBreadcrumb, KdsButton_default as KdsButton, KdsCard_default as KdsCard, KdsCheckbox_default as KdsCheckbox, KdsCheckboxGroup_default as KdsCheckboxGroup, KdsClickableCard_default as KdsClickableCard, KdsColorInput_default as KdsColorInput, KdsColorSwatch_default as KdsColorSwatch, KdsContextMenu_default as KdsContextMenu, KdsDataType_default as KdsDataType, KdsDateInput_default as KdsDateInput, KdsDateTimeFormatInput_default as KdsDateTimeFormatInput, KdsDateTimeInput_default as KdsDateTimeInput, KdsDescription_default as KdsDescription, KdsDivider_default as KdsDivider, KdsDonutChart_default as KdsDonutChart, KdsDropdown_default as KdsDropdown, KdsDynamicModalProvider_default as KdsDynamicModalProvider, KdsEmptyState_default as KdsEmptyState, KdsFileExplorer_default as KdsFileExplorer, KdsFileSelector_default as KdsFileSelector, KdsIcon_default as KdsIcon, KdsInfoToggleButton_default as KdsInfoToggleButton, KdsInlineMessage_default as KdsInlineMessage, KdsIntervalInput_default as KdsIntervalInput, KdsKeyboardShortcut_default as KdsKeyboardShortcut, KdsLabel_default as KdsLabel, KdsLimitBar_default as KdsLimitBar, KdsLink_default as KdsLink, KdsLinkButton_default as KdsLinkButton, KdsLinkCard_default as KdsLinkCard, KdsListContainer_default as KdsListContainer, KdsLiveStatus_default as KdsLiveStatus, KdsLoadingSkeleton_default as KdsLoadingSkeleton, KdsLoadingSpinner_default as KdsLoadingSpinner, KdsMenu_default as KdsMenu, KdsMenuButton_default as KdsMenuButton, KdsMissingValueIcon_default as KdsMissingValueIcon, KdsModal_default as KdsModal, KdsModalLayout_default as KdsModalLayout, KdsMultiSelectButton_default as KdsMultiSelectButton, KdsMultiSelectDropdown_default as KdsMultiSelectDropdown, KdsNavItem_default as KdsNavItem, KdsNavigation_default as KdsNavigation, KdsNumberInput_default as KdsNumberInput, KdsPagination_default as KdsPagination, KdsPanel_default as KdsPanel, KdsPasswordInput_default as KdsPasswordInput, KdsPatternInput_default as KdsPatternInput, KdsPopover_default as KdsPopover, KdsPortIcon_default as KdsPortIcon, KdsPreviewList_default as KdsPreviewList, KdsProgressBar_default as KdsProgressBar, KdsProgressButton_default as KdsProgressButton, KdsRadioButton_default as KdsRadioButton, KdsRadioButtonGroup_default as KdsRadioButtonGroup, KdsResponsiveButtonGroup_default as KdsResponsiveButtonGroup, KdsSearchInput_default as KdsSearchInput, KdsSelectButton_default as KdsSelectButton, KdsSelectableCard_default as KdsSelectableCard, KdsSideDrawer_default as KdsSideDrawer, KdsSortableListBox_default as KdsSortableListBox, KdsSplitButton_default as KdsSplitButton, KdsSplitPanel_default as KdsSplitPanel, KdsSubText_default as KdsSubText, KdsTabBar_default as KdsTabBar, KdsTabPanel_default as KdsTabPanel, KdsTextHighlight_default as KdsTextHighlight, KdsTextInput_default as KdsTextInput, KdsTextarea_default as KdsTextarea, KdsTimeInput_default as KdsTimeInput, KdsToggleButton_default as KdsToggleButton, KdsToggleSwitch_default as KdsToggleSwitch, KdsTree_default as KdsTree, KdsTwinList_default as KdsTwinList, KdsUsernameInput_default as KdsUsernameInput, KdsValueSwitch_default as KdsValueSwitch, KdsVariableToggleButton_default as KdsVariableToggleButton, KdsZonedDateTimeInput_default as KdsZonedDateTimeInput, PORT_SIZE, kdsAccessorySize, kdsAccessorySizes, kdsAccessoryType, kdsAccessoryTypes, kdsActionButtonType, kdsActionButtonTypes, kdsAvatarSize, kdsAvatarSizes, kdsBadgeSize, kdsBadgeSizes, kdsBadgeVariant, kdsBadgeVariants, kdsFeedbackVariant as kdsBannerVariant, kdsFeedbackVariant as kdsInlineMessageVariant, kdsFeedbackVariants as kdsBannerVariants, kdsFeedbackVariants as kdsInlineMessageVariants, kdsButtonSize, kdsButtonSizes, kdsButtonVariant, kdsButtonVariants, kdsCardBodyVariant, kdsCardBodyVariants, kdsCardVariant, kdsCardVariants, kdsCheckboxGroupAlignment, kdsCheckboxGroupAlignments, kdsCheckboxValue, kdsCheckboxValues, kdsColorSwatchSize, kdsColorSwatchSizes, kdsColorSwatchType, kdsColorSwatchTypes, kdsDarkModeType, kdsDarkModeTypes, kdsDataTypeSize, kdsDataTypeSizes, kdsDateFormatCategories, kdsDateFormatCategory, kdsFileExplorerDraggingAnimationMode, kdsFileExplorerDraggingAnimationModes, kdsFileExplorerSize, kdsFileExplorerSizes, kdsIconName, iconNames as kdsIconNames, kdsIconSize, kdsIconSizes, kdsIntervalDirectionalities, kdsIntervalDirectionality, kdsIntervalInputFormat, kdsIntervalInputFormats, kdsKeyboardShortcutSize, kdsKeyboardShortcutSizes, kdsLimitBarThresholdVariant, kdsLimitBarThresholdVariants, kdsLinkSize, kdsLinkSizes, kdsLiveStatusSize, kdsLiveStatusSizes, kdsLiveStatusStatus, kdsLiveStatusStatuses, kdsLoadingSkeletonVariant, kdsLoadingSkeletonVariants, kdsLoadingSpinnerVariant, kdsLoadingSpinnerVariants, kdsModalClosedBy, kdsModalClosedByOptions, kdsModalHeight, kdsModalHeightSizes, kdsModalVariant, kdsModalVariants, kdsModalWidth, kdsModalWidthSizes, kdsPanelBodyOverflow, kdsPanelBodyOverflows, kdsPanelBodyVariant, kdsPanelBodyVariants, kdsPasswordInputAutocomplete, kdsPasswordInputAutocompletes, kdsPasswordInputVariant, kdsPasswordInputVariants, kdsPopoverPlacement, kdsPopoverPlacements, kdsPopoverRole, kdsPopoverRoles, kdsPopoverType, kdsPopoverTypes, kdsPortType, kdsPortTypes, kdsProgressBarSize, kdsProgressBarSizes, kdsProgressButtonState, kdsProgressButtonStates, kdsRadioButtonGroupAlignment, kdsRadioButtonGroupAlignments, kdsResponsiveButtonGroupAlignment, kdsResponsiveButtonGroupAlignments, kdsSplitPanelDirection, kdsSplitPanelDirections, kdsTabBarSize, kdsTabBarSizes, kdsTemporalType, kdsTemporalTypes, kdsTimeInputGranularities, kdsTimeInputGranularity, kdsToggleButtonVariant, kdsToggleButtonVariants, kdsToggleSwitchLabelPosition, kdsToggleSwitchLabelPositions, kdsToggleSwitchSize, kdsToggleSwitchSizes, kdsTwinListSearchMode, kdsTwinListSearchModes, kdsTypeIconName, typeIconNames as kdsTypeIconNames, kdsUsernameInputAutocomplete, kdsUsernameInputAutocompletes, kdsValueSwitchSize, kdsValueSwitchSizes, kdsValueSwitchVariant, kdsValueSwitchVariants, useKdsDarkMode, useKdsDynamicModal, useKdsIsTruncated, useKdsMultiSelection, useKdsNameValidator, vKdsTooltip };
|
|
36632
|
+
export { KdsAccordion_default as KdsAccordion, KdsAvatar_default as KdsAvatar, KdsAvatarCounter_default as KdsAvatarCounter, KdsBadge_default as KdsBadge, KdsBanner_default as KdsBanner, KdsBreadcrumb_default as KdsBreadcrumb, KdsButton_default as KdsButton, KdsCard_default as KdsCard, KdsCheckbox_default as KdsCheckbox, KdsCheckboxGroup_default as KdsCheckboxGroup, KdsClickableCard_default as KdsClickableCard, KdsColorInput_default as KdsColorInput, KdsColorSwatch_default as KdsColorSwatch, KdsContextMenu_default as KdsContextMenu, KdsDataType_default as KdsDataType, KdsDateInput_default as KdsDateInput, KdsDateTimeFormatInput_default as KdsDateTimeFormatInput, KdsDateTimeInput_default as KdsDateTimeInput, KdsDescription_default as KdsDescription, KdsDivider_default as KdsDivider, KdsDonutChart_default as KdsDonutChart, KdsDropdown_default as KdsDropdown, KdsDynamicModalProvider_default as KdsDynamicModalProvider, KdsEmptyState_default as KdsEmptyState, KdsFileExplorer_default as KdsFileExplorer, KdsFileSelector_default as KdsFileSelector, KdsIcon_default as KdsIcon, KdsInfoToggleButton_default as KdsInfoToggleButton, KdsInlineMessage_default as KdsInlineMessage, KdsIntervalInput_default as KdsIntervalInput, KdsKeyboardShortcut_default as KdsKeyboardShortcut, KdsLabel_default as KdsLabel, KdsLimitBar_default as KdsLimitBar, KdsLink_default as KdsLink, KdsLinkButton_default as KdsLinkButton, KdsLinkCard_default as KdsLinkCard, KdsListContainer_default as KdsListContainer, KdsLiveStatus_default as KdsLiveStatus, KdsLoadingSkeleton_default as KdsLoadingSkeleton, KdsLoadingSpinner_default as KdsLoadingSpinner, KdsMenu_default as KdsMenu, KdsMenuButton_default as KdsMenuButton, KdsMissingValueIcon_default as KdsMissingValueIcon, KdsModal_default as KdsModal, KdsModalLayout_default as KdsModalLayout, KdsMultiSelectButton_default as KdsMultiSelectButton, KdsMultiSelectDropdown_default as KdsMultiSelectDropdown, KdsNavItem_default as KdsNavItem, KdsNavigation_default as KdsNavigation, KdsNumberInput_default as KdsNumberInput, KdsPagination_default as KdsPagination, KdsPanel_default as KdsPanel, KdsPasswordInput_default as KdsPasswordInput, KdsPatternInput_default as KdsPatternInput, KdsPopover_default as KdsPopover, KdsPortIcon_default as KdsPortIcon, KdsPreviewList_default as KdsPreviewList, KdsProgressBar_default as KdsProgressBar, KdsProgressButton_default as KdsProgressButton, KdsRadioButton_default as KdsRadioButton, KdsRadioButtonGroup_default as KdsRadioButtonGroup, KdsResponsiveButtonGroup_default as KdsResponsiveButtonGroup, KdsSearchInput_default as KdsSearchInput, KdsSelectButton_default as KdsSelectButton, KdsSelectableCard_default as KdsSelectableCard, KdsSideDrawer_default as KdsSideDrawer, KdsSortableListBox_default as KdsSortableListBox, KdsSplitButton_default as KdsSplitButton, KdsSplitPanel_default as KdsSplitPanel, KdsSubText_default as KdsSubText, KdsTabBar_default as KdsTabBar, KdsTabPanel_default as KdsTabPanel, KdsTextHighlight_default as KdsTextHighlight, KdsTextInput_default as KdsTextInput, KdsTextarea_default as KdsTextarea, KdsTimeInput_default as KdsTimeInput, KdsToggleButton_default as KdsToggleButton, KdsToggleSwitch_default as KdsToggleSwitch, KdsTree_default as KdsTree, KdsTwinList_default as KdsTwinList, KdsUsernameInput_default as KdsUsernameInput, KdsValueSwitch_default as KdsValueSwitch, KdsVariableToggleButton_default as KdsVariableToggleButton, KdsZonedDateTimeInput_default as KdsZonedDateTimeInput, PORT_SIZE, kdsAccessorySize, kdsAccessorySizes, kdsAccessoryType, kdsAccessoryTypes, kdsActionButtonType, kdsActionButtonTypes, kdsAvatarSize, kdsAvatarSizes, kdsBadgeSize, kdsBadgeSizes, kdsBadgeVariant, kdsBadgeVariants, kdsFeedbackVariant as kdsBannerVariant, kdsFeedbackVariant as kdsInlineMessageVariant, kdsFeedbackVariants as kdsBannerVariants, kdsFeedbackVariants as kdsInlineMessageVariants, kdsButtonSize, kdsButtonSizes, kdsButtonVariant, kdsButtonVariants, kdsCardBodyVariant, kdsCardBodyVariants, kdsCardVariant, kdsCardVariants, kdsCheckboxGroupAlignment, kdsCheckboxGroupAlignments, kdsCheckboxValue, kdsCheckboxValues, kdsColorSwatchSize, kdsColorSwatchSizes, kdsColorSwatchType, kdsColorSwatchTypes, kdsDarkModeType, kdsDarkModeTypes, kdsDataTypeSize, kdsDataTypeSizes, kdsDateFormatCategories, kdsDateFormatCategory, kdsFileExplorerDraggingAnimationMode, kdsFileExplorerDraggingAnimationModes, kdsFileExplorerSize, kdsFileExplorerSizes, kdsIconName, iconNames as kdsIconNames, kdsIconSize, kdsIconSizes, kdsIntervalDirectionalities, kdsIntervalDirectionality, kdsIntervalInputFormat, kdsIntervalInputFormats, kdsKeyboardShortcutSize, kdsKeyboardShortcutSizes, kdsLimitBarThresholdVariant, kdsLimitBarThresholdVariants, kdsLinkSize, kdsLinkSizes, kdsLiveStatusSize, kdsLiveStatusSizes, kdsLiveStatusStatus, kdsLiveStatusStatuses, kdsLoadingSkeletonVariant, kdsLoadingSkeletonVariants, kdsLoadingSpinnerVariant, kdsLoadingSpinnerVariants, kdsModalClosedBy, kdsModalClosedByOptions, kdsModalHeight, kdsModalHeightSizes, kdsModalVariant, kdsModalVariants, kdsModalWidth, kdsModalWidthSizes, kdsPanelBodyOverflow, kdsPanelBodyOverflows, kdsPanelBodyVariant, kdsPanelBodyVariants, kdsPasswordInputAutocomplete, kdsPasswordInputAutocompletes, kdsPasswordInputVariant, kdsPasswordInputVariants, kdsPopoverPlacement, kdsPopoverPlacements, kdsPopoverRole, kdsPopoverRoles, kdsPopoverType, kdsPopoverTypes, kdsPortType, kdsPortTypes, kdsProgressBarSize, kdsProgressBarSizes, kdsProgressButtonState, kdsProgressButtonStates, kdsRadioButtonGroupAlignment, kdsRadioButtonGroupAlignments, kdsResponsiveButtonGroupAlignment, kdsResponsiveButtonGroupAlignments, kdsSplitPanelDirection, kdsSplitPanelDirections, kdsTabBarSize, kdsTabBarSizes, kdsTemporalType, kdsTemporalTypes, kdsTimeInputGranularities, kdsTimeInputGranularity, kdsToggleButtonVariant, kdsToggleButtonVariants, kdsToggleSwitchLabelPosition, kdsToggleSwitchLabelPositions, kdsToggleSwitchSize, kdsToggleSwitchSizes, kdsTwinListSearchMode, kdsTwinListSearchModes, kdsTypeIconName, typeIconNames as kdsTypeIconNames, kdsUsernameInputAutocomplete, kdsUsernameInputAutocompletes, kdsValueSwitchSize, kdsValueSwitchSizes, kdsValueSwitchVariant, kdsValueSwitchVariants, useKdsDarkMode, useKdsDarkModeController, useKdsDynamicModal, useKdsIsTruncated, useKdsMultiSelection, useKdsNameValidator, vKdsTooltip };
|
|
36353
36633
|
|
|
36354
36634
|
//# sourceMappingURL=index.js.map
|