@ni/ok-components 1.6.4 → 1.6.6
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'
|
|
@@ -70337,9 +70393,6 @@ img.ProseMirror-separator {
|
|
|
70337
70393
|
--ni-private-switch-indicator-size: 24px;
|
|
70338
70394
|
--ni-private-switch-indicator-inner-size: 18px;
|
|
70339
70395
|
--ni-private-switch-indicator-margin: -2px;
|
|
70340
|
-
padding-bottom: calc(
|
|
70341
|
-
${controlHeight} - var(--ni-private-switch-height)
|
|
70342
|
-
);
|
|
70343
70396
|
}
|
|
70344
70397
|
|
|
70345
70398
|
:host([disabled]) {
|
|
@@ -70364,6 +70417,12 @@ img.ProseMirror-separator {
|
|
|
70364
70417
|
.switch-container {
|
|
70365
70418
|
display: flex;
|
|
70366
70419
|
align-items: center;
|
|
70420
|
+
${'' /*
|
|
70421
|
+
Reserve space around the 24px control to fill a 32px height until we have a switch 32 design.
|
|
70422
|
+
See: https://github.com/ni/nimble/issues/3013
|
|
70423
|
+
*/}
|
|
70424
|
+
padding-top: 2px;
|
|
70425
|
+
padding-bottom: 6px;
|
|
70367
70426
|
}
|
|
70368
70427
|
|
|
70369
70428
|
slot[name='unchecked-message']::slotted(*) {
|
|
@@ -103169,6 +103228,7 @@ focus outline in that case.
|
|
|
103169
103228
|
/** @internal */
|
|
103170
103229
|
this.attachmentsIsEmpty = true;
|
|
103171
103230
|
this.updateScrollbarWidthQueued = false;
|
|
103231
|
+
this.fieldSizingSupported = CSS.supports('field-sizing', 'content');
|
|
103172
103232
|
}
|
|
103173
103233
|
slottedFooterActionsElementsChanged(_prev, next) {
|
|
103174
103234
|
this.footerActionsIsEmpty = next === undefined || next.length === 0;
|
|
@@ -103290,7 +103350,7 @@ focus outline in that case.
|
|
|
103290
103350
|
// Workaround for browsers that do not support the CSS property `field-sizing: content`
|
|
103291
103351
|
// See https://github.com/ni/nimble/issues/2902
|
|
103292
103352
|
adjustTextAreaHeight() {
|
|
103293
|
-
if (
|
|
103353
|
+
if (this.fieldSizingSupported || !this.textArea) {
|
|
103294
103354
|
return;
|
|
103295
103355
|
}
|
|
103296
103356
|
const textArea = this.textArea;
|
|
@@ -103302,7 +103362,6 @@ focus outline in that case.
|
|
|
103302
103362
|
this.scrollbarWidth = this.textArea.offsetWidth - this.textArea.clientWidth;
|
|
103303
103363
|
}
|
|
103304
103364
|
}
|
|
103305
|
-
ChatInput.fieldSizingSupported = CSS.supports('field-sizing', 'content');
|
|
103306
103365
|
__decorate([
|
|
103307
103366
|
attr
|
|
103308
103367
|
], ChatInput.prototype, "placeholder", void 0);
|