1 |
|
2 |
|
3 |
|
4 | 'use strict';
|
5 |
|
6 | Object.defineProperty(exports, '__esModule', { value: true });
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor, getOwnPropertyNames, getPrototypeOf, hasOwnProperty, isFrozen, keys, seal, setPrototypeOf, } = Object;
|
19 | const { filter: ArrayFilter, find: ArrayFind, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, push: ArrayPush, reduce: ArrayReduce, reverse: ArrayReverse, slice: ArraySlice, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
|
20 | const { charCodeAt: StringCharCodeAt, replace: StringReplace, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
|
21 | function isUndefined(obj) {
|
22 | return obj === undefined;
|
23 | }
|
24 | function isTrue$1(obj) {
|
25 | return obj === true;
|
26 | }
|
27 | function isFalse$1(obj) {
|
28 | return obj === false;
|
29 | }
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | const AriaPropertyNames = [
|
47 | 'ariaActiveDescendant',
|
48 | 'ariaAtomic',
|
49 | 'ariaAutoComplete',
|
50 | 'ariaBusy',
|
51 | 'ariaChecked',
|
52 | 'ariaColCount',
|
53 | 'ariaColIndex',
|
54 | 'ariaColSpan',
|
55 | 'ariaControls',
|
56 | 'ariaCurrent',
|
57 | 'ariaDescribedBy',
|
58 | 'ariaDetails',
|
59 | 'ariaDisabled',
|
60 | 'ariaErrorMessage',
|
61 | 'ariaExpanded',
|
62 | 'ariaFlowTo',
|
63 | 'ariaHasPopup',
|
64 | 'ariaHidden',
|
65 | 'ariaInvalid',
|
66 | 'ariaKeyShortcuts',
|
67 | 'ariaLabel',
|
68 | 'ariaLabelledBy',
|
69 | 'ariaLevel',
|
70 | 'ariaLive',
|
71 | 'ariaModal',
|
72 | 'ariaMultiLine',
|
73 | 'ariaMultiSelectable',
|
74 | 'ariaOrientation',
|
75 | 'ariaOwns',
|
76 | 'ariaPlaceholder',
|
77 | 'ariaPosInSet',
|
78 | 'ariaPressed',
|
79 | 'ariaReadOnly',
|
80 | 'ariaRelevant',
|
81 | 'ariaRequired',
|
82 | 'ariaRoleDescription',
|
83 | 'ariaRowCount',
|
84 | 'ariaRowIndex',
|
85 | 'ariaRowSpan',
|
86 | 'ariaSelected',
|
87 | 'ariaSetSize',
|
88 | 'ariaSort',
|
89 | 'ariaValueMax',
|
90 | 'ariaValueMin',
|
91 | 'ariaValueNow',
|
92 | 'ariaValueText',
|
93 | 'role',
|
94 | ];
|
95 | const AttrNameToPropNameMap = create(null);
|
96 | const PropNameToAttrNameMap = create(null);
|
97 |
|
98 | forEach.call(AriaPropertyNames, (propName) => {
|
99 |
|
100 |
|
101 |
|
102 | const attrName = StringToLowerCase.call(StringReplace.call(propName, /^aria/, 'aria-'));
|
103 | AttrNameToPropNameMap[attrName] = propName;
|
104 | PropNameToAttrNameMap[propName] = attrName;
|
105 | });
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 | const _globalThis = (function () {
|
115 |
|
116 | if (typeof globalThis === 'object') {
|
117 | return globalThis;
|
118 | }
|
119 | let _globalThis;
|
120 | try {
|
121 |
|
122 | Object.defineProperty(Object.prototype, '__magic__', {
|
123 | get: function () {
|
124 | return this;
|
125 | },
|
126 | configurable: true,
|
127 | });
|
128 |
|
129 |
|
130 |
|
131 | _globalThis = __magic__;
|
132 |
|
133 | delete Object.prototype.__magic__;
|
134 | }
|
135 | catch (ex) {
|
136 |
|
137 | }
|
138 | finally {
|
139 |
|
140 |
|
141 | if (typeof _globalThis === 'undefined') {
|
142 |
|
143 | _globalThis = window;
|
144 | }
|
145 | }
|
146 | return _globalThis;
|
147 | })();
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 | const hasNativeSymbolsSupport = Symbol('x').toString() === 'Symbol(x)';
|
162 | const HTML_ATTRIBUTES_TO_PROPERTY = {
|
163 | accesskey: 'accessKey',
|
164 | readonly: 'readOnly',
|
165 | tabindex: 'tabIndex',
|
166 | bgcolor: 'bgColor',
|
167 | colspan: 'colSpan',
|
168 | rowspan: 'rowSpan',
|
169 | contenteditable: 'contentEditable',
|
170 | crossorigin: 'crossOrigin',
|
171 | datetime: 'dateTime',
|
172 | formaction: 'formAction',
|
173 | ismap: 'isMap',
|
174 | maxlength: 'maxLength',
|
175 | minlength: 'minLength',
|
176 | novalidate: 'noValidate',
|
177 | usemap: 'useMap',
|
178 | for: 'htmlFor',
|
179 | };
|
180 | keys(HTML_ATTRIBUTES_TO_PROPERTY).forEach((attrName) => {
|
181 | });
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 | if (!_globalThis.lwcRuntimeFlags) {
|
191 | Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
192 | }
|
193 | const runtimeFlags = _globalThis.lwcRuntimeFlags;
|
194 |
|
195 |
|
196 | function setFeatureFlag(name, value) {
|
197 | const isBoolean = isTrue$1(value) || isFalse$1(value);
|
198 | if (!isBoolean) {
|
199 | const message = `Failed to set the value "${value}" for the runtime feature flag "${name}". Runtime feature flags can only be set to a boolean value.`;
|
200 | if (process.env.NODE_ENV !== 'production') {
|
201 | throw new TypeError(message);
|
202 | }
|
203 | else {
|
204 |
|
205 | console.error(message);
|
206 | return;
|
207 | }
|
208 | }
|
209 | if (isUndefined(featureFlagLookup[name])) {
|
210 |
|
211 | console.warn(`Failed to set the value "${value}" for the runtime feature flag "${name}" because it is undefined. Possible reasons are that 1) it was misspelled or 2) it was removed from the @lwc/features package.`);
|
212 | return;
|
213 | }
|
214 | if (process.env.NODE_ENV !== 'production') {
|
215 |
|
216 | runtimeFlags[name] = value;
|
217 | }
|
218 | else {
|
219 |
|
220 | const runtimeValue = runtimeFlags[name];
|
221 | if (!isUndefined(runtimeValue)) {
|
222 |
|
223 | console.error(`Failed to set the value "${value}" for the runtime feature flag "${name}". "${name}" has already been set with the value "${runtimeValue}".`);
|
224 | return;
|
225 | }
|
226 | Object.defineProperty(runtimeFlags, name, { value });
|
227 | }
|
228 | }
|
229 |
|
230 |
|
231 | function setFeatureFlagForTest(name, value) {
|
232 | if (process.env.NODE_ENV !== 'production') {
|
233 | return setFeatureFlag(name, value);
|
234 | }
|
235 | }
|
236 |
|
237 | const featureFlagLookup = {
|
238 | ENABLE_REACTIVE_SETTER: null,
|
239 |
|
240 | ENABLE_ELEMENT_PATCH: null,
|
241 | ENABLE_NODE_LIST_PATCH: null,
|
242 | ENABLE_HTML_COLLECTIONS_PATCH: null,
|
243 | ENABLE_NODE_PATCH: null,
|
244 | };
|
245 |
|
246 | exports.default = featureFlagLookup;
|
247 | exports.runtimeFlags = runtimeFlags;
|
248 | exports.setFeatureFlag = setFeatureFlag;
|
249 | exports.setFeatureFlagForTest = setFeatureFlagForTest;
|
250 |
|