@ni/ok-components 1.6.4 → 1.6.5
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.
|
@@ -121,6 +121,50 @@
|
|
|
121
121
|
if ($global.trustedTypes === void 0) {
|
|
122
122
|
$global.trustedTypes = { createPolicy: (n, r) => r };
|
|
123
123
|
}
|
|
124
|
+
// Shims of globals for SSR environments that load client code in the server module graph
|
|
125
|
+
// Shim only what is not defined in-case SSR env is loading their own polyfills (which would need to be loaded first).
|
|
126
|
+
for (const name of [
|
|
127
|
+
"Node",
|
|
128
|
+
"Element",
|
|
129
|
+
"HTMLElement",
|
|
130
|
+
"ShadowRoot",
|
|
131
|
+
"Event",
|
|
132
|
+
"CustomEvent",
|
|
133
|
+
"MutationObserver",
|
|
134
|
+
"ResizeObserver",
|
|
135
|
+
"IntersectionObserver",
|
|
136
|
+
"CSSStyleSheet"
|
|
137
|
+
]) {
|
|
138
|
+
if (typeof ($global[name]) === "undefined") {
|
|
139
|
+
$global[name] = class {
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// Minimal custom elements registry for the react wrapper to leverage for tag names
|
|
144
|
+
if (typeof ($global.customElements) === "undefined") {
|
|
145
|
+
const constructorsByName = new Map();
|
|
146
|
+
const namesByConstructor = new Map();
|
|
147
|
+
$global.customElements = {
|
|
148
|
+
define(name, constructor) {
|
|
149
|
+
if (!constructorsByName.has(name)) {
|
|
150
|
+
constructorsByName.set(name, constructor);
|
|
151
|
+
namesByConstructor.set(constructor, name);
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
get(name) {
|
|
155
|
+
return constructorsByName.get(name);
|
|
156
|
+
},
|
|
157
|
+
getName(constructor) {
|
|
158
|
+
return namesByConstructor.get(constructor) ?? null;
|
|
159
|
+
},
|
|
160
|
+
whenDefined() {
|
|
161
|
+
return Promise.resolve();
|
|
162
|
+
},
|
|
163
|
+
upgrade() {
|
|
164
|
+
// no-op
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
}
|
|
124
168
|
const propConfig = {
|
|
125
169
|
configurable: false,
|
|
126
170
|
enumerable: false,
|
|
@@ -250,7 +294,9 @@
|
|
|
250
294
|
/**
|
|
251
295
|
* Indicates whether the DOM supports the adoptedStyleSheets feature.
|
|
252
296
|
*/
|
|
253
|
-
supportsAdoptedStyleSheets:
|
|
297
|
+
supportsAdoptedStyleSheets: typeof document !== "undefined" &&
|
|
298
|
+
typeof CSSStyleSheet !== "undefined" &&
|
|
299
|
+
Array.isArray(document.adoptedStyleSheets) &&
|
|
254
300
|
"replace" in CSSStyleSheet.prototype,
|
|
255
301
|
/**
|
|
256
302
|
* Sets the HTML trusted types policy used by the templating engine.
|
|
@@ -6913,7 +6959,8 @@
|
|
|
6913
6959
|
/**
|
|
6914
6960
|
* @alpha
|
|
6915
6961
|
*/
|
|
6916
|
-
const supportsElementInternals =
|
|
6962
|
+
const supportsElementInternals = typeof window !== "undefined" &&
|
|
6963
|
+
ElementInternalsKey in window &&
|
|
6917
6964
|
"setFormValue" in window[ElementInternalsKey].prototype;
|
|
6918
6965
|
const InternalsMap = new WeakMap();
|
|
6919
6966
|
/**
|
|
@@ -9021,7 +9068,7 @@
|
|
|
9021
9068
|
return false;
|
|
9022
9069
|
}
|
|
9023
9070
|
|
|
9024
|
-
const defaultElement = document.createElement("div");
|
|
9071
|
+
const defaultElement = typeof document === "undefined" ? {} : document.createElement("div");
|
|
9025
9072
|
function isFastElement(element) {
|
|
9026
9073
|
return element instanceof FASTElement;
|
|
9027
9074
|
}
|
|
@@ -9195,7 +9242,7 @@
|
|
|
9195
9242
|
* @param root - the root to normalize
|
|
9196
9243
|
*/
|
|
9197
9244
|
static normalizeRoot(root) {
|
|
9198
|
-
return root === defaultElement ? document : root;
|
|
9245
|
+
return (root === defaultElement && typeof document !== "undefined") ? document : root;
|
|
9199
9246
|
}
|
|
9200
9247
|
}
|
|
9201
9248
|
// Caches PropertyTarget instances
|
|
@@ -9212,6 +9259,12 @@
|
|
|
9212
9259
|
*/
|
|
9213
9260
|
const PropertyTargetManager = Object.freeze({
|
|
9214
9261
|
getOrCreate(source) {
|
|
9262
|
+
if (typeof document === "undefined") {
|
|
9263
|
+
return {
|
|
9264
|
+
setProperty() { },
|
|
9265
|
+
removeProperty() { },
|
|
9266
|
+
};
|
|
9267
|
+
}
|
|
9215
9268
|
if (propertyTargetCache.has(source)) {
|
|
9216
9269
|
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
|
|
9217
9270
|
return propertyTargetCache.get(source);
|
|
@@ -14922,7 +14975,10 @@
|
|
|
14922
14975
|
*/
|
|
14923
14976
|
class DocumentElementLang {
|
|
14924
14977
|
constructor() {
|
|
14925
|
-
this.lang = document.documentElement.lang;
|
|
14978
|
+
this.lang = typeof document === 'undefined' ? '' : document.documentElement.lang;
|
|
14979
|
+
if (typeof document === 'undefined') {
|
|
14980
|
+
return;
|
|
14981
|
+
}
|
|
14926
14982
|
const observer = new MutationObserver(mutations => {
|
|
14927
14983
|
for (const mutation of mutations) {
|
|
14928
14984
|
if (mutation.type === 'attributes'
|
|
@@ -103169,6 +103225,7 @@ focus outline in that case.
|
|
|
103169
103225
|
/** @internal */
|
|
103170
103226
|
this.attachmentsIsEmpty = true;
|
|
103171
103227
|
this.updateScrollbarWidthQueued = false;
|
|
103228
|
+
this.fieldSizingSupported = CSS.supports('field-sizing', 'content');
|
|
103172
103229
|
}
|
|
103173
103230
|
slottedFooterActionsElementsChanged(_prev, next) {
|
|
103174
103231
|
this.footerActionsIsEmpty = next === undefined || next.length === 0;
|
|
@@ -103290,7 +103347,7 @@ focus outline in that case.
|
|
|
103290
103347
|
// Workaround for browsers that do not support the CSS property `field-sizing: content`
|
|
103291
103348
|
// See https://github.com/ni/nimble/issues/2902
|
|
103292
103349
|
adjustTextAreaHeight() {
|
|
103293
|
-
if (
|
|
103350
|
+
if (this.fieldSizingSupported || !this.textArea) {
|
|
103294
103351
|
return;
|
|
103295
103352
|
}
|
|
103296
103353
|
const textArea = this.textArea;
|
|
@@ -103302,7 +103359,6 @@ focus outline in that case.
|
|
|
103302
103359
|
this.scrollbarWidth = this.textArea.offsetWidth - this.textArea.clientWidth;
|
|
103303
103360
|
}
|
|
103304
103361
|
}
|
|
103305
|
-
ChatInput.fieldSizingSupported = CSS.supports('field-sizing', 'content');
|
|
103306
103362
|
__decorate([
|
|
103307
103363
|
attr
|
|
103308
103364
|
], ChatInput.prototype, "placeholder", void 0);
|