@typespec/playground 0.5.0-dev.4 → 0.5.0-dev.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.
- package/dist/.storybook/main.d.ts +0 -1
- package/dist/.storybook/preview.d.ts +0 -1
- package/dist/manifest-onl5D1yL-onl5D1yL.js +6 -0
- package/dist/react/index.js +356 -333
- package/dist/src/browser-host.d.ts +0 -1
- package/dist/src/editor-command-bar/editor-command-bar.d.ts +0 -1
- package/dist/src/manifest.d.ts +0 -1
- package/dist/src/react/context/playground-context.d.ts +0 -1
- package/dist/src/react/default-footer.d.ts +0 -1
- package/dist/src/react/diagnostic-list/diagnostic-list.d.ts +0 -1
- package/dist/src/react/editor.d.ts +0 -1
- package/dist/src/react/emitter-dropdown.d.ts +0 -1
- package/dist/src/react/file-output/file-output.d.ts +0 -1
- package/dist/src/react/footer/footer-item.d.ts +0 -1
- package/dist/src/react/footer/footer.d.ts +0 -1
- package/dist/src/react/output-tabs/output-tabs.d.ts +0 -1
- package/dist/src/react/output-view/file-viewer.d.ts +0 -1
- package/dist/src/react/output-view/output-view.d.ts +0 -1
- package/dist/src/react/output-view/type-graph-viewer.d.ts +0 -1
- package/dist/src/react/playground.d.ts +0 -1
- package/dist/src/react/problem-pane/header.d.ts +0 -1
- package/dist/src/react/problem-pane/problem-pane.d.ts +0 -1
- package/dist/src/react/samples-dropdown.d.ts +0 -1
- package/dist/src/react/settings/compiler-settings-dialog-button.d.ts +0 -1
- package/dist/src/react/settings/compiler-settings.d.ts +0 -1
- package/dist/src/react/settings/emitter-options-form.d.ts +0 -1
- package/dist/src/react/settings/linter-form.d.ts +0 -1
- package/dist/src/react/standalone.d.ts +0 -1
- package/dist/src/react/types.d.ts +0 -1
- package/dist/src/react/typespec-editor.d.ts +0 -1
- package/dist/src/react/viewers/index.d.ts +0 -1
- package/dist/src/react/viewers/swagger-ui.d.ts +0 -1
- package/dist/src/services.d.ts +0 -1
- package/dist/src/tooling/index.d.ts +0 -1
- package/dist/src/tooling/types.d.ts +0 -1
- package/dist/src/types.d.ts +0 -1
- package/dist/src/vite/index.d.ts +0 -1
- package/dist/src/vite/types.d.ts +0 -1
- package/dist/stories/footer/footer-item.stories.d.ts +0 -1
- package/dist/stories/footer/footer-version-item.stories.d.ts +0 -1
- package/dist/stories/footer/footer.stories.d.ts +0 -1
- package/dist/stories/playground.stories.d.ts +0 -1
- package/dist/vite.config.d.ts +1 -1
- package/package.json +29 -35
- package/dist/manifest-Cewnx59A-Cewnx59A.js +0 -6
package/dist/react/index.js
CHANGED
|
@@ -2323,18 +2323,13 @@ function createFileViewer(fileViewers) {
|
|
|
2323
2323
|
}
|
|
2324
2324
|
|
|
2325
2325
|
function _extends() {
|
|
2326
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
2327
|
-
for (var
|
|
2328
|
-
var
|
|
2329
|
-
for (var
|
|
2330
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
2331
|
-
target[key] = source[key];
|
|
2332
|
-
}
|
|
2333
|
-
}
|
|
2326
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
2327
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
2328
|
+
var t = arguments[e];
|
|
2329
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
2334
2330
|
}
|
|
2335
|
-
return
|
|
2336
|
-
};
|
|
2337
|
-
return _extends.apply(this, arguments);
|
|
2331
|
+
return n;
|
|
2332
|
+
}, _extends.apply(null, arguments);
|
|
2338
2333
|
}
|
|
2339
2334
|
|
|
2340
2335
|
var reservedModifierKeywords = ['shift', 'alt', 'meta', 'mod', 'ctrl'];
|
|
@@ -2360,7 +2355,7 @@ var mappedKeys = {
|
|
|
2360
2355
|
ControlRight: 'ctrl'
|
|
2361
2356
|
};
|
|
2362
2357
|
function mapKey(key) {
|
|
2363
|
-
return (mappedKeys[key] || key).trim().toLowerCase().replace(/key|digit|numpad|arrow/, '');
|
|
2358
|
+
return (key && mappedKeys[key] || key || '').trim().toLowerCase().replace(/key|digit|numpad|arrow/, '');
|
|
2364
2359
|
}
|
|
2365
2360
|
function isHotkeyModifier(key) {
|
|
2366
2361
|
return reservedModifierKeywords.includes(key);
|
|
@@ -2600,7 +2595,9 @@ var stopPropagation = function stopPropagation(e) {
|
|
|
2600
2595
|
};
|
|
2601
2596
|
var useSafeLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
2602
2597
|
function useHotkeys(keys, callback, options, dependencies) {
|
|
2603
|
-
var
|
|
2598
|
+
var _useState = useState(null),
|
|
2599
|
+
ref = _useState[0],
|
|
2600
|
+
setRef = _useState[1];
|
|
2604
2601
|
var hasTriggeredRef = useRef(false);
|
|
2605
2602
|
var _options = !(options instanceof Array) ? options : !(dependencies instanceof Array) ? dependencies : undefined;
|
|
2606
2603
|
var _keys = isReadonlyArray(keys) ? keys.join(_options == null ? void 0 : _options.splitKey) : keys;
|
|
@@ -2630,9 +2627,9 @@ function useHotkeys(keys, callback, options, dependencies) {
|
|
|
2630
2627
|
}
|
|
2631
2628
|
// TODO: SINCE THE EVENT IS NOW ATTACHED TO THE REF, THE ACTIVE ELEMENT CAN NEVER BE INSIDE THE REF. THE HOTKEY ONLY TRIGGERS IF THE
|
|
2632
2629
|
// REF IS THE ACTIVE ELEMENT. THIS IS A PROBLEM SINCE FOCUSED SUB COMPONENTS WON'T TRIGGER THE HOTKEY.
|
|
2633
|
-
if (ref
|
|
2634
|
-
var rootNode = ref.
|
|
2635
|
-
if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement !== ref
|
|
2630
|
+
if (ref !== null) {
|
|
2631
|
+
var rootNode = ref.getRootNode();
|
|
2632
|
+
if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement !== ref && !ref.contains(rootNode.activeElement)) {
|
|
2636
2633
|
stopPropagation(e);
|
|
2637
2634
|
return;
|
|
2638
2635
|
}
|
|
@@ -2684,7 +2681,7 @@ function useHotkeys(keys, callback, options, dependencies) {
|
|
|
2684
2681
|
listener(event, true);
|
|
2685
2682
|
}
|
|
2686
2683
|
};
|
|
2687
|
-
var domNode = ref
|
|
2684
|
+
var domNode = ref || (_options == null ? void 0 : _options.document) || document;
|
|
2688
2685
|
// @ts-ignore
|
|
2689
2686
|
domNode.addEventListener('keyup', handleKeyUp);
|
|
2690
2687
|
// @ts-ignore
|
|
@@ -2705,8 +2702,8 @@ function useHotkeys(keys, callback, options, dependencies) {
|
|
|
2705
2702
|
});
|
|
2706
2703
|
}
|
|
2707
2704
|
};
|
|
2708
|
-
}, [_keys, memoisedOptions, enabledScopes]);
|
|
2709
|
-
return
|
|
2705
|
+
}, [ref, _keys, memoisedOptions, enabledScopes]);
|
|
2706
|
+
return setRef;
|
|
2710
2707
|
}
|
|
2711
2708
|
|
|
2712
2709
|
/**
|
|
@@ -9556,7 +9553,7 @@ class TabsterCore {
|
|
|
9556
9553
|
this._forgetMemorizedElements = [];
|
|
9557
9554
|
this._wrappers = new Set();
|
|
9558
9555
|
this._initQueue = [];
|
|
9559
|
-
this._version = "8.0
|
|
9556
|
+
this._version = "8.1.0";
|
|
9560
9557
|
this._noop = false;
|
|
9561
9558
|
|
|
9562
9559
|
this.getWindow = () => {
|
|
@@ -10076,66 +10073,76 @@ function isHTMLElement(target) {
|
|
|
10076
10073
|
* @returns single merged tabster attribute
|
|
10077
10074
|
*/ const useMergedTabsterAttributes_unstable = (...attributes)=>{
|
|
10078
10075
|
'use no memo';
|
|
10079
|
-
const stringAttributes = attributes.
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
attributes.shift();
|
|
10083
|
-
for (const attr of stringAttributes){
|
|
10084
|
-
attribute = mergeAttributes(attribute, attr);
|
|
10076
|
+
const stringAttributes = attributes.reduce((acc, curr)=>{
|
|
10077
|
+
if (curr[TABSTER_ATTRIBUTE_NAME]) {
|
|
10078
|
+
acc.push(curr[TABSTER_ATTRIBUTE_NAME]);
|
|
10085
10079
|
}
|
|
10086
|
-
return
|
|
10087
|
-
|
|
10088
|
-
|
|
10080
|
+
return acc;
|
|
10081
|
+
}, []);
|
|
10082
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
10083
|
+
// ignoring rules of hooks because this is a condition based on the environment
|
|
10084
|
+
// it's safe to ignore the rule
|
|
10085
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
10086
|
+
useWarnIfUnstableAttributes(stringAttributes);
|
|
10087
|
+
}
|
|
10088
|
+
return React.useMemo(()=>({
|
|
10089
|
+
[TABSTER_ATTRIBUTE_NAME]: stringAttributes.length > 0 ? stringAttributes.reduce(mergeJSONStrings) : undefined
|
|
10090
|
+
}), // disable exhaustive-deps because we want to memoize the result of the reduction
|
|
10091
|
+
// this is safe because the collection of attributes is not expected to change at runtime
|
|
10089
10092
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10090
|
-
|
|
10093
|
+
stringAttributes);
|
|
10091
10094
|
};
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
}
|
|
10104
|
-
if (b) {
|
|
10105
|
-
try {
|
|
10106
|
-
bParsed = JSON.parse(b);
|
|
10107
|
-
// eslint-disable-next-line no-empty
|
|
10108
|
-
} catch {}
|
|
10095
|
+
/**
|
|
10096
|
+
* Merges two JSON strings into one.
|
|
10097
|
+
*/ const mergeJSONStrings = (a, b)=>JSON.stringify(Object.assign(safelyParseJSON(a), safelyParseJSON(b)));
|
|
10098
|
+
/**
|
|
10099
|
+
* Tries to parse a JSON string and returns an object.
|
|
10100
|
+
* If the JSON string is invalid, an empty object is returned.
|
|
10101
|
+
*/ const safelyParseJSON = (json)=>{
|
|
10102
|
+
try {
|
|
10103
|
+
return JSON.parse(json);
|
|
10104
|
+
} catch {
|
|
10105
|
+
return {};
|
|
10109
10106
|
}
|
|
10110
|
-
|
|
10111
|
-
...aParsed,
|
|
10112
|
-
...bParsed
|
|
10113
|
-
});
|
|
10114
|
-
}
|
|
10115
|
-
|
|
10107
|
+
};
|
|
10116
10108
|
/**
|
|
10117
|
-
*
|
|
10109
|
+
* Helper hook that ensures that the attributes passed to the hook are stable.
|
|
10110
|
+
* This is necessary because the attributes are expected to not change at runtime.
|
|
10118
10111
|
*
|
|
10119
|
-
*
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
}
|
|
10112
|
+
* This hook will console.warn if the attributes change at runtime.
|
|
10113
|
+
*/ const useWarnIfUnstableAttributes = (attributes)=>{
|
|
10114
|
+
'use no memo';
|
|
10115
|
+
const initialAttributesRef = React.useRef(attributes);
|
|
10116
|
+
let isStable = initialAttributesRef.current.length === attributes.length;
|
|
10117
|
+
if (initialAttributesRef.current !== attributes && isStable) {
|
|
10118
|
+
for(let i = 0; i < attributes.length; i++){
|
|
10119
|
+
if (initialAttributesRef.current[i] !== attributes[i]) {
|
|
10120
|
+
isStable = false;
|
|
10121
|
+
break;
|
|
10122
|
+
}
|
|
10123
|
+
}
|
|
10124
|
+
}
|
|
10125
|
+
React.useEffect(()=>{
|
|
10126
|
+
if (!isStable) {
|
|
10127
|
+
const error = new Error();
|
|
10128
|
+
// eslint-disable-next-line no-console
|
|
10129
|
+
console.warn(/** #__DE-INDENT__ */ `
|
|
10130
|
+
@fluentui/react-tabster [useMergedTabsterAttributes]:
|
|
10131
|
+
The attributes passed to the hook changed at runtime.
|
|
10132
|
+
This might lead to unexpected behavior, please ensure that the attributes are stable.
|
|
10133
|
+
${error.stack}
|
|
10134
|
+
`);
|
|
10135
|
+
}
|
|
10136
|
+
}, [
|
|
10137
|
+
isStable
|
|
10138
|
+
]);
|
|
10139
|
+
};
|
|
10131
10140
|
|
|
10132
10141
|
// ----
|
|
10133
|
-
|
|
10134
10142
|
// Heads up!
|
|
10135
10143
|
// These constants are global and will be shared between Griffel instances.
|
|
10136
10144
|
// Any change in them should happen only in a MAJOR version. If it happens,
|
|
10137
10145
|
// please change "__NAMESPACE_PREFIX__" to include a version.
|
|
10138
|
-
|
|
10139
10146
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10140
10147
|
const __GLOBAL__ = typeof window === 'undefined' ? global : window;
|
|
10141
10148
|
const __NAMESPACE_PREFIX__ = '@griffel/';
|
|
@@ -10145,232 +10152,31 @@ function getGlobalVar(name, defaultValue) {
|
|
|
10145
10152
|
}
|
|
10146
10153
|
return __GLOBAL__[Symbol.for(__NAMESPACE_PREFIX__ + name)];
|
|
10147
10154
|
}
|
|
10148
|
-
|
|
10149
10155
|
/** @internal */
|
|
10150
10156
|
const DEBUG_RESET_CLASSES = /*#__PURE__*/getGlobalVar('DEBUG_RESET_CLASSES', {});
|
|
10151
|
-
|
|
10152
10157
|
/** @internal */
|
|
10153
10158
|
const DEFINITION_LOOKUP_TABLE = /*#__PURE__*/getGlobalVar('DEFINITION_LOOKUP_TABLE', {});
|
|
10154
|
-
|
|
10155
10159
|
// ----
|
|
10156
|
-
|
|
10157
10160
|
/** @internal */
|
|
10158
10161
|
const DATA_BUCKET_ATTR = 'data-make-styles-bucket';
|
|
10159
|
-
|
|
10160
10162
|
/** @internal */
|
|
10161
10163
|
const DATA_PRIORITY_ATTR = 'data-priority';
|
|
10162
|
-
|
|
10163
10164
|
/** @internal */
|
|
10164
10165
|
const RESET_HASH_PREFIX = 'r';
|
|
10165
|
-
|
|
10166
10166
|
/** @internal */
|
|
10167
10167
|
const SEQUENCE_HASH_LENGTH = 7;
|
|
10168
|
-
|
|
10169
10168
|
/** @internal */
|
|
10170
10169
|
const SEQUENCE_PREFIX = '___';
|
|
10171
|
-
|
|
10172
10170
|
/** @internal */
|
|
10173
10171
|
const DEBUG_SEQUENCE_SEPARATOR = '_';
|
|
10174
|
-
|
|
10175
10172
|
/** @internal */
|
|
10176
10173
|
const SEQUENCE_SIZE = process.env.NODE_ENV === 'production' ? SEQUENCE_PREFIX.length + SEQUENCE_HASH_LENGTH : SEQUENCE_PREFIX.length + SEQUENCE_HASH_LENGTH + DEBUG_SEQUENCE_SEPARATOR.length + SEQUENCE_HASH_LENGTH;
|
|
10177
|
-
|
|
10178
10174
|
// indexes for values in LookupItem tuple
|
|
10179
|
-
|
|
10180
10175
|
/** @internal */
|
|
10181
10176
|
const LOOKUP_DEFINITIONS_INDEX = 0;
|
|
10182
|
-
|
|
10183
10177
|
/** @internal */
|
|
10184
10178
|
const LOOKUP_DIR_INDEX = 1;
|
|
10185
10179
|
|
|
10186
|
-
function createIsomorphicStyleSheet(styleElement, bucketName, priority, elementAttributes) {
|
|
10187
|
-
// no CSSStyleSheet in SSR, just append rules here for server render
|
|
10188
|
-
const __cssRulesForSSR = [];
|
|
10189
|
-
elementAttributes[DATA_BUCKET_ATTR] = bucketName;
|
|
10190
|
-
elementAttributes[DATA_PRIORITY_ATTR] = String(priority);
|
|
10191
|
-
if (styleElement) {
|
|
10192
|
-
for (const attrName in elementAttributes) {
|
|
10193
|
-
styleElement.setAttribute(attrName, elementAttributes[attrName]);
|
|
10194
|
-
}
|
|
10195
|
-
}
|
|
10196
|
-
function insertRule(rule) {
|
|
10197
|
-
if (styleElement != null && styleElement.sheet) {
|
|
10198
|
-
return styleElement.sheet.insertRule(rule, styleElement.sheet.cssRules.length);
|
|
10199
|
-
}
|
|
10200
|
-
return __cssRulesForSSR.push(rule);
|
|
10201
|
-
}
|
|
10202
|
-
return {
|
|
10203
|
-
elementAttributes,
|
|
10204
|
-
insertRule,
|
|
10205
|
-
element: styleElement,
|
|
10206
|
-
bucketName,
|
|
10207
|
-
cssRules() {
|
|
10208
|
-
if (styleElement != null && styleElement.sheet) {
|
|
10209
|
-
return Array.from(styleElement.sheet.cssRules).map(cssRule => cssRule.cssText);
|
|
10210
|
-
}
|
|
10211
|
-
return __cssRulesForSSR;
|
|
10212
|
-
}
|
|
10213
|
-
};
|
|
10214
|
-
}
|
|
10215
|
-
|
|
10216
|
-
/**
|
|
10217
|
-
* Ordered style buckets using their short pseudo name.
|
|
10218
|
-
*
|
|
10219
|
-
* @internal
|
|
10220
|
-
*/
|
|
10221
|
-
const styleBucketOrdering = [
|
|
10222
|
-
// reset styles
|
|
10223
|
-
'r',
|
|
10224
|
-
// catch-all
|
|
10225
|
-
'd',
|
|
10226
|
-
// link
|
|
10227
|
-
'l',
|
|
10228
|
-
// visited
|
|
10229
|
-
'v',
|
|
10230
|
-
// focus-within
|
|
10231
|
-
'w',
|
|
10232
|
-
// focus
|
|
10233
|
-
'f',
|
|
10234
|
-
// focus-visible
|
|
10235
|
-
'i',
|
|
10236
|
-
// hover
|
|
10237
|
-
'h',
|
|
10238
|
-
// active
|
|
10239
|
-
'a',
|
|
10240
|
-
// at rules for reset styles
|
|
10241
|
-
's',
|
|
10242
|
-
// keyframes
|
|
10243
|
-
'k',
|
|
10244
|
-
// at-rules
|
|
10245
|
-
't',
|
|
10246
|
-
// @media rules
|
|
10247
|
-
'm',
|
|
10248
|
-
// @container rules
|
|
10249
|
-
'c'];
|
|
10250
|
-
|
|
10251
|
-
// avoid repeatedly calling `indexOf` to determine order during new insertions
|
|
10252
|
-
const styleBucketOrderingMap = /*#__PURE__*/styleBucketOrdering.reduce((acc, cur, j) => {
|
|
10253
|
-
acc[cur] = j;
|
|
10254
|
-
return acc;
|
|
10255
|
-
}, {});
|
|
10256
|
-
function getStyleSheetKey(bucketName, media, priority) {
|
|
10257
|
-
return (bucketName === 'm' ? bucketName + media : bucketName) + priority;
|
|
10258
|
-
}
|
|
10259
|
-
|
|
10260
|
-
/**
|
|
10261
|
-
* Lazily adds a `<style>` bucket to the `<head>`. This will ensure that the style buckets are ordered.
|
|
10262
|
-
*/
|
|
10263
|
-
function getStyleSheetForBucket(bucketName, targetDocument, insertionPoint, renderer, metadata = {}) {
|
|
10264
|
-
var _ref, _ref2;
|
|
10265
|
-
const isMediaBucket = bucketName === 'm';
|
|
10266
|
-
const media = (_ref = metadata['m']) != null ? _ref : '0';
|
|
10267
|
-
const priority = (_ref2 = metadata['p']) != null ? _ref2 : 0;
|
|
10268
|
-
const stylesheetKey = getStyleSheetKey(bucketName, media, priority);
|
|
10269
|
-
if (!renderer.stylesheets[stylesheetKey]) {
|
|
10270
|
-
const tag = targetDocument && targetDocument.createElement('style');
|
|
10271
|
-
const stylesheet = createIsomorphicStyleSheet(tag, bucketName, priority, Object.assign({}, renderer.styleElementAttributes, isMediaBucket && {
|
|
10272
|
-
media
|
|
10273
|
-
}));
|
|
10274
|
-
renderer.stylesheets[stylesheetKey] = stylesheet;
|
|
10275
|
-
if (targetDocument && tag) {
|
|
10276
|
-
targetDocument.head.insertBefore(tag, findInsertionPoint(targetDocument, insertionPoint, bucketName, renderer, metadata));
|
|
10277
|
-
}
|
|
10278
|
-
}
|
|
10279
|
-
return renderer.stylesheets[stylesheetKey];
|
|
10280
|
-
}
|
|
10281
|
-
function isSameInsertionKey(element, bucketName, metadata) {
|
|
10282
|
-
var _ref3, _element$media;
|
|
10283
|
-
const targetKey = bucketName + ((_ref3 = metadata['m']) != null ? _ref3 : '');
|
|
10284
|
-
const elementKey = element.getAttribute(DATA_BUCKET_ATTR) + ((_element$media = element.media) != null ? _element$media : '');
|
|
10285
|
-
return targetKey === elementKey;
|
|
10286
|
-
}
|
|
10287
|
-
|
|
10288
|
-
/**
|
|
10289
|
-
* Finds an element before which the new bucket style element should be inserted following the bucket sort order.
|
|
10290
|
-
*
|
|
10291
|
-
* @param targetDocument - A document
|
|
10292
|
-
* @param insertionPoint - An element that will be used as an initial insertion point
|
|
10293
|
-
* @param targetBucket - The bucket that should be inserted to DOM
|
|
10294
|
-
* @param renderer - Griffel renderer
|
|
10295
|
-
* @param metadata - metadata for CSS rule
|
|
10296
|
-
* @returns - Smallest style element with greater sort order than the current bucket
|
|
10297
|
-
*/
|
|
10298
|
-
function findInsertionPoint(targetDocument, insertionPoint, targetBucket, renderer, metadata = {}) {
|
|
10299
|
-
var _ref4, _ref5;
|
|
10300
|
-
const targetOrder = styleBucketOrderingMap[targetBucket];
|
|
10301
|
-
const media = (_ref4 = metadata['m']) != null ? _ref4 : '';
|
|
10302
|
-
const priority = (_ref5 = metadata['p']) != null ? _ref5 : 0;
|
|
10303
|
-
|
|
10304
|
-
// Similar to javascript sort comparators where
|
|
10305
|
-
// a positive value is increasing sort order
|
|
10306
|
-
// a negative value is decreasing sort order
|
|
10307
|
-
let comparer = el => targetOrder - styleBucketOrderingMap[el.getAttribute(DATA_BUCKET_ATTR)];
|
|
10308
|
-
let styleElements = targetDocument.head.querySelectorAll(`[${DATA_BUCKET_ATTR}]`);
|
|
10309
|
-
if (targetBucket === 'm') {
|
|
10310
|
-
const mediaElements = targetDocument.head.querySelectorAll(`[${DATA_BUCKET_ATTR}="${targetBucket}"]`);
|
|
10311
|
-
|
|
10312
|
-
// only reduce the scope of the search and change comparer
|
|
10313
|
-
// if there are other media buckets already on the page
|
|
10314
|
-
if (mediaElements.length) {
|
|
10315
|
-
styleElements = mediaElements;
|
|
10316
|
-
comparer = el => renderer.compareMediaQueries(media, el.media);
|
|
10317
|
-
}
|
|
10318
|
-
}
|
|
10319
|
-
const comparerWithPriority = el => {
|
|
10320
|
-
if (isSameInsertionKey(el, targetBucket, metadata)) {
|
|
10321
|
-
return priority - Number(el.getAttribute('data-priority'));
|
|
10322
|
-
}
|
|
10323
|
-
return comparer(el);
|
|
10324
|
-
};
|
|
10325
|
-
const length = styleElements.length;
|
|
10326
|
-
let index = length - 1;
|
|
10327
|
-
while (index >= 0) {
|
|
10328
|
-
const styleElement = styleElements.item(index);
|
|
10329
|
-
if (comparerWithPriority(styleElement) > 0) {
|
|
10330
|
-
return styleElement.nextSibling;
|
|
10331
|
-
}
|
|
10332
|
-
index--;
|
|
10333
|
-
}
|
|
10334
|
-
if (length > 0) {
|
|
10335
|
-
return styleElements.item(0);
|
|
10336
|
-
}
|
|
10337
|
-
return insertionPoint ? insertionPoint.nextSibling : null;
|
|
10338
|
-
}
|
|
10339
|
-
|
|
10340
|
-
/**
|
|
10341
|
-
* Suffixes to be ignored in case of error
|
|
10342
|
-
*/
|
|
10343
|
-
const ignoreSuffixes = /*#__PURE__*/['-moz-placeholder', '-moz-focus-inner', '-moz-focusring', '-ms-input-placeholder', '-moz-read-write', '-moz-read-only'].join('|');
|
|
10344
|
-
const ignoreSuffixesRegex = /*#__PURE__*/new RegExp(`:(${ignoreSuffixes})`);
|
|
10345
|
-
|
|
10346
|
-
/**
|
|
10347
|
-
* @internal
|
|
10348
|
-
*
|
|
10349
|
-
* Calls `sheet.insertRule` and catches errors related to browser prefixes.
|
|
10350
|
-
*/
|
|
10351
|
-
function safeInsertRule(sheet, ruleCSS) {
|
|
10352
|
-
try {
|
|
10353
|
-
sheet.insertRule(ruleCSS);
|
|
10354
|
-
} catch (e) {
|
|
10355
|
-
// We've disabled these warnings due to false-positive errors with browser prefixes
|
|
10356
|
-
if (process.env.NODE_ENV !== 'production' && !ignoreSuffixesRegex.test(ruleCSS)) {
|
|
10357
|
-
// eslint-disable-next-line no-console
|
|
10358
|
-
console.error(`There was a problem inserting the following rule: "${ruleCSS}"`, e);
|
|
10359
|
-
}
|
|
10360
|
-
}
|
|
10361
|
-
}
|
|
10362
|
-
|
|
10363
|
-
const isDevToolsEnabled = /*#__PURE__*/(() => {
|
|
10364
|
-
// Accessing "window.sessionStorage" causes an exception when third party cookies are blocked
|
|
10365
|
-
// https://stackoverflow.com/questions/30481516/iframe-in-chrome-error-failed-to-read-localstorage-from-window-access-deni
|
|
10366
|
-
try {
|
|
10367
|
-
var _window$sessionStorag;
|
|
10368
|
-
return Boolean(typeof window !== 'undefined' && ((_window$sessionStorag = window.sessionStorage) == null ? void 0 : _window$sessionStorag.getItem('__GRIFFEL_DEVTOOLS__')));
|
|
10369
|
-
} catch (e) {
|
|
10370
|
-
return false;
|
|
10371
|
-
}
|
|
10372
|
-
})();
|
|
10373
|
-
|
|
10374
10180
|
/* eslint-disable */
|
|
10375
10181
|
// Inspired by https://github.com/garycourt/murmurhash-js
|
|
10376
10182
|
// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
|
|
@@ -10454,7 +10260,6 @@ function reduceToClassName(classMap, dir) {
|
|
|
10454
10260
|
// `hashString` is needed to handle `null` values in a class map as they don't produce any classes.
|
|
10455
10261
|
let classString = '';
|
|
10456
10262
|
let hashString = '';
|
|
10457
|
-
|
|
10458
10263
|
// eslint-disable-next-line guard-for-in
|
|
10459
10264
|
for (const propertyHash in classMap) {
|
|
10460
10265
|
const classNameMapping = classMap[propertyHash];
|
|
@@ -10469,7 +10274,6 @@ function reduceToClassName(classMap, dir) {
|
|
|
10469
10274
|
}
|
|
10470
10275
|
return [classString.slice(0, -1), hashString.slice(0, -1)];
|
|
10471
10276
|
}
|
|
10472
|
-
|
|
10473
10277
|
/**
|
|
10474
10278
|
* Reduces classname maps for slots to classname strings. Registers them in a definition cache to be used by
|
|
10475
10279
|
* `mergeClasses()`.
|
|
@@ -10478,11 +10282,9 @@ function reduceToClassName(classMap, dir) {
|
|
|
10478
10282
|
*/
|
|
10479
10283
|
function reduceToClassNameForSlots(classesMapBySlot, dir) {
|
|
10480
10284
|
const classNamesForSlots = {};
|
|
10481
|
-
|
|
10482
10285
|
// eslint-disable-next-line guard-for-in
|
|
10483
10286
|
for (const slotName in classesMapBySlot) {
|
|
10484
10287
|
const [slotClasses, slotClassesHash] = reduceToClassName(classesMapBySlot[slotName], dir);
|
|
10485
|
-
|
|
10486
10288
|
// Handles a case when there are no classes in a set i.e. "makeStyles({ root: {} })"
|
|
10487
10289
|
if (slotClassesHash === '') {
|
|
10488
10290
|
classNamesForSlots[slotName] = '';
|
|
@@ -10498,33 +10300,12 @@ function reduceToClassNameForSlots(classesMapBySlot, dir) {
|
|
|
10498
10300
|
|
|
10499
10301
|
// Contains a mapping of previously resolved sequences of atomic classnames
|
|
10500
10302
|
const mergeClassesCachedResults = {};
|
|
10501
|
-
|
|
10502
|
-
/**
|
|
10503
|
-
* Function can take any number of arguments, joins classes together and deduplicates atomic declarations generated by
|
|
10504
|
-
* `makeStyles()`. Handles scoped directional styles.
|
|
10505
|
-
*
|
|
10506
|
-
* Classnames can be of any length, this function can take both atomic declarations and class names.
|
|
10507
|
-
*
|
|
10508
|
-
* Input:
|
|
10509
|
-
* ```
|
|
10510
|
-
* // not real classes
|
|
10511
|
-
* mergeClasses('ui-button', 'displayflex', 'displaygrid')
|
|
10512
|
-
* ```
|
|
10513
|
-
*
|
|
10514
|
-
* Output:
|
|
10515
|
-
* ```
|
|
10516
|
-
* 'ui-button displaygrid'
|
|
10517
|
-
* ```
|
|
10518
|
-
*/
|
|
10519
|
-
|
|
10520
10303
|
function mergeClasses() {
|
|
10521
10304
|
// arguments are parsed manually to avoid double loops as TS & Babel transforms rest via an additional loop
|
|
10522
10305
|
// @see https://babeljs.io/docs/en/babel-plugin-transform-parameters
|
|
10523
10306
|
/* eslint-disable prefer-rest-params */
|
|
10524
|
-
|
|
10525
10307
|
let dir = null;
|
|
10526
10308
|
let resultClassName = '';
|
|
10527
|
-
|
|
10528
10309
|
// Is used as a cache key to avoid object merging
|
|
10529
10310
|
let sequenceMatch = '';
|
|
10530
10311
|
const sequencesIds = new Array(arguments.length);
|
|
@@ -10551,7 +10332,6 @@ function mergeClasses() {
|
|
|
10551
10332
|
resultClassName += className + ' ';
|
|
10552
10333
|
} else {
|
|
10553
10334
|
const sequenceId = className.substr(sequenceIndex, SEQUENCE_SIZE);
|
|
10554
|
-
|
|
10555
10335
|
// Handles a case with mixed classnames, i.e. "ui-button ATOMIC_CLASSES"
|
|
10556
10336
|
if (sequenceIndex > 0) {
|
|
10557
10337
|
resultClassName += className.slice(0, sequenceIndex);
|
|
@@ -10567,13 +10347,11 @@ function mergeClasses() {
|
|
|
10567
10347
|
}
|
|
10568
10348
|
}
|
|
10569
10349
|
}
|
|
10570
|
-
|
|
10571
10350
|
// .slice() there allows to avoid trailing space for non-atomic classes
|
|
10572
10351
|
// "ui-button ui-flex " => "ui-button ui-flex"
|
|
10573
10352
|
if (sequenceMatch === '') {
|
|
10574
10353
|
return resultClassName.slice(0, -1);
|
|
10575
10354
|
}
|
|
10576
|
-
|
|
10577
10355
|
// It's safe to reuse results to avoid continuous merging as results are stable
|
|
10578
10356
|
// "__seq1 ... __seq2 ..." => "__seq12 ..."
|
|
10579
10357
|
const mergeClassesResult = mergeClassesCachedResults[sequenceMatch];
|
|
@@ -10602,13 +10380,11 @@ function mergeClasses() {
|
|
|
10602
10380
|
}
|
|
10603
10381
|
}
|
|
10604
10382
|
}
|
|
10605
|
-
|
|
10606
10383
|
// eslint-disable-next-line prefer-spread
|
|
10607
10384
|
const resultClassesMap = Object.assign.apply(Object,
|
|
10608
10385
|
// .assign() mutates the first object, we can't mutate mappings as it will produce invalid results later
|
|
10609
10386
|
[{}].concat(sequenceMappings));
|
|
10610
10387
|
const [atomicClasses, classesMapHash] = reduceToClassName(resultClassesMap, dir);
|
|
10611
|
-
|
|
10612
10388
|
// Each merge of classes generates a new sequence of atomic classes that needs to be registered
|
|
10613
10389
|
const newSequenceHash = hashSequence(classesMapHash, dir, sequencesIds);
|
|
10614
10390
|
const newClassName = newSequenceHash + ' ' + atomicClasses;
|
|
@@ -10698,7 +10474,7 @@ function getDebugTree(debugSequenceHash, parentNode) {
|
|
|
10698
10474
|
return undefined;
|
|
10699
10475
|
}
|
|
10700
10476
|
const parentLookupItem = parentNode ? DEFINITION_LOOKUP_TABLE[parentNode.sequenceHash] : undefined;
|
|
10701
|
-
const debugClassNames = getDebugClassNames(lookupItem, parentLookupItem, parentNode
|
|
10477
|
+
const debugClassNames = getDebugClassNames(lookupItem, parentLookupItem, parentNode === null || parentNode === void 0 ? void 0 : parentNode.debugClassNames, parentNode === null || parentNode === void 0 ? void 0 : parentNode.children);
|
|
10702
10478
|
const node = {
|
|
10703
10479
|
sequenceHash: debugSequenceHash,
|
|
10704
10480
|
direction: lookupItem[1],
|
|
@@ -10713,7 +10489,6 @@ function getDebugTree(debugSequenceHash, parentNode) {
|
|
|
10713
10489
|
node.children.push(child);
|
|
10714
10490
|
}
|
|
10715
10491
|
});
|
|
10716
|
-
|
|
10717
10492
|
// if it's leaf (makeStyle node), get css rules
|
|
10718
10493
|
if (!node.children.length) {
|
|
10719
10494
|
node.rules = {};
|
|
@@ -10757,10 +10532,207 @@ function injectDevTools(document) {
|
|
|
10757
10532
|
});
|
|
10758
10533
|
}
|
|
10759
10534
|
|
|
10535
|
+
const isDevToolsEnabled = /*#__PURE__*/(() => {
|
|
10536
|
+
var _a;
|
|
10537
|
+
// Accessing "window.sessionStorage" causes an exception when third party cookies are blocked
|
|
10538
|
+
// https://stackoverflow.com/questions/30481516/iframe-in-chrome-error-failed-to-read-localstorage-from-window-access-deni
|
|
10539
|
+
try {
|
|
10540
|
+
return Boolean(typeof window !== 'undefined' && ((_a = window.sessionStorage) === null || _a === void 0 ? void 0 : _a.getItem('__GRIFFEL_DEVTOOLS__')));
|
|
10541
|
+
} catch (e) {
|
|
10542
|
+
return false;
|
|
10543
|
+
}
|
|
10544
|
+
})();
|
|
10545
|
+
|
|
10546
|
+
/**
|
|
10547
|
+
* @internal
|
|
10548
|
+
*
|
|
10549
|
+
* @param entry - CSS bucket entry that can be either a string or an array
|
|
10550
|
+
* @returns An array where the first element is the CSS rule
|
|
10551
|
+
*/
|
|
10552
|
+
function normalizeCSSBucketEntry(entry) {
|
|
10553
|
+
if (!Array.isArray(entry)) {
|
|
10554
|
+
return [entry];
|
|
10555
|
+
}
|
|
10556
|
+
if (process.env.NODE_ENV !== 'production' && entry.length > 2) {
|
|
10557
|
+
throw new Error('CSS Bucket contains an entry with greater than 2 items, please report this to https://github.com/microsoft/griffel/issues');
|
|
10558
|
+
}
|
|
10559
|
+
return entry;
|
|
10560
|
+
}
|
|
10561
|
+
|
|
10562
|
+
function createIsomorphicStyleSheet(styleElement, bucketName, priority, elementAttributes) {
|
|
10563
|
+
// no CSSStyleSheet in SSR, just append rules here for server render
|
|
10564
|
+
const __cssRulesForSSR = [];
|
|
10565
|
+
elementAttributes[DATA_BUCKET_ATTR] = bucketName;
|
|
10566
|
+
elementAttributes[DATA_PRIORITY_ATTR] = String(priority);
|
|
10567
|
+
if (styleElement) {
|
|
10568
|
+
for (const attrName in elementAttributes) {
|
|
10569
|
+
styleElement.setAttribute(attrName, elementAttributes[attrName]);
|
|
10570
|
+
}
|
|
10571
|
+
}
|
|
10572
|
+
function insertRule(rule) {
|
|
10573
|
+
if (styleElement === null || styleElement === void 0 ? void 0 : styleElement.sheet) {
|
|
10574
|
+
return styleElement.sheet.insertRule(rule, styleElement.sheet.cssRules.length);
|
|
10575
|
+
}
|
|
10576
|
+
return __cssRulesForSSR.push(rule);
|
|
10577
|
+
}
|
|
10578
|
+
return {
|
|
10579
|
+
elementAttributes,
|
|
10580
|
+
insertRule,
|
|
10581
|
+
element: styleElement,
|
|
10582
|
+
bucketName,
|
|
10583
|
+
cssRules() {
|
|
10584
|
+
if (styleElement === null || styleElement === void 0 ? void 0 : styleElement.sheet) {
|
|
10585
|
+
return Array.from(styleElement.sheet.cssRules).map(cssRule => cssRule.cssText);
|
|
10586
|
+
}
|
|
10587
|
+
return __cssRulesForSSR;
|
|
10588
|
+
}
|
|
10589
|
+
};
|
|
10590
|
+
}
|
|
10591
|
+
|
|
10592
|
+
/**
|
|
10593
|
+
* Ordered style buckets using their short pseudo name.
|
|
10594
|
+
*
|
|
10595
|
+
* @internal
|
|
10596
|
+
*/
|
|
10597
|
+
const styleBucketOrdering = [
|
|
10598
|
+
// reset styles
|
|
10599
|
+
'r',
|
|
10600
|
+
// catch-all
|
|
10601
|
+
'd',
|
|
10602
|
+
// link
|
|
10603
|
+
'l',
|
|
10604
|
+
// visited
|
|
10605
|
+
'v',
|
|
10606
|
+
// focus-within
|
|
10607
|
+
'w',
|
|
10608
|
+
// focus
|
|
10609
|
+
'f',
|
|
10610
|
+
// focus-visible
|
|
10611
|
+
'i',
|
|
10612
|
+
// hover
|
|
10613
|
+
'h',
|
|
10614
|
+
// active
|
|
10615
|
+
'a',
|
|
10616
|
+
// at rules for reset styles
|
|
10617
|
+
's',
|
|
10618
|
+
// keyframes
|
|
10619
|
+
'k',
|
|
10620
|
+
// at-rules
|
|
10621
|
+
't',
|
|
10622
|
+
// @media rules
|
|
10623
|
+
'm',
|
|
10624
|
+
// @container rules
|
|
10625
|
+
'c'];
|
|
10626
|
+
// avoid repeatedly calling `indexOf` to determine order during new insertions
|
|
10627
|
+
const styleBucketOrderingMap = /*#__PURE__*/styleBucketOrdering.reduce((acc, cur, j) => {
|
|
10628
|
+
acc[cur] = j;
|
|
10629
|
+
return acc;
|
|
10630
|
+
}, {});
|
|
10631
|
+
function getStyleSheetKey(bucketName, media, priority) {
|
|
10632
|
+
return (bucketName === 'm' ? bucketName + media : bucketName) + priority;
|
|
10633
|
+
}
|
|
10634
|
+
/**
|
|
10635
|
+
* Lazily adds a `<style>` bucket to the `<head>`. This will ensure that the style buckets are ordered.
|
|
10636
|
+
*/
|
|
10637
|
+
function getStyleSheetForBucket(bucketName, targetDocument, insertionPoint, renderer, metadata = {}) {
|
|
10638
|
+
var _a, _b;
|
|
10639
|
+
const isMediaBucket = bucketName === 'm';
|
|
10640
|
+
const media = (_a = metadata['m']) !== null && _a !== void 0 ? _a : '0';
|
|
10641
|
+
const priority = (_b = metadata['p']) !== null && _b !== void 0 ? _b : 0;
|
|
10642
|
+
const stylesheetKey = getStyleSheetKey(bucketName, media, priority);
|
|
10643
|
+
if (!renderer.stylesheets[stylesheetKey]) {
|
|
10644
|
+
const tag = targetDocument && targetDocument.createElement('style');
|
|
10645
|
+
const stylesheet = createIsomorphicStyleSheet(tag, bucketName, priority, Object.assign({}, renderer.styleElementAttributes, isMediaBucket && {
|
|
10646
|
+
media
|
|
10647
|
+
}));
|
|
10648
|
+
renderer.stylesheets[stylesheetKey] = stylesheet;
|
|
10649
|
+
if (targetDocument && tag) {
|
|
10650
|
+
targetDocument.head.insertBefore(tag, findInsertionPoint(targetDocument, insertionPoint, bucketName, renderer, metadata));
|
|
10651
|
+
}
|
|
10652
|
+
}
|
|
10653
|
+
return renderer.stylesheets[stylesheetKey];
|
|
10654
|
+
}
|
|
10655
|
+
function isSameInsertionKey(element, bucketName, metadata) {
|
|
10656
|
+
var _a, _b;
|
|
10657
|
+
const targetKey = bucketName + ((_a = metadata['m']) !== null && _a !== void 0 ? _a : '');
|
|
10658
|
+
const elementKey = element.getAttribute(DATA_BUCKET_ATTR) + ((_b = element.media) !== null && _b !== void 0 ? _b : '');
|
|
10659
|
+
return targetKey === elementKey;
|
|
10660
|
+
}
|
|
10661
|
+
/**
|
|
10662
|
+
* Finds an element before which the new bucket style element should be inserted following the bucket sort order.
|
|
10663
|
+
*
|
|
10664
|
+
* @param targetDocument - A document
|
|
10665
|
+
* @param insertionPoint - An element that will be used as an initial insertion point
|
|
10666
|
+
* @param targetBucket - The bucket that should be inserted to DOM
|
|
10667
|
+
* @param renderer - Griffel renderer
|
|
10668
|
+
* @param metadata - metadata for CSS rule
|
|
10669
|
+
* @returns - Smallest style element with greater sort order than the current bucket
|
|
10670
|
+
*/
|
|
10671
|
+
function findInsertionPoint(targetDocument, insertionPoint, targetBucket, renderer, metadata = {}) {
|
|
10672
|
+
var _a, _b;
|
|
10673
|
+
const targetOrder = styleBucketOrderingMap[targetBucket];
|
|
10674
|
+
const media = (_a = metadata['m']) !== null && _a !== void 0 ? _a : '';
|
|
10675
|
+
const priority = (_b = metadata['p']) !== null && _b !== void 0 ? _b : 0;
|
|
10676
|
+
// Similar to javascript sort comparators where
|
|
10677
|
+
// a positive value is increasing sort order
|
|
10678
|
+
// a negative value is decreasing sort order
|
|
10679
|
+
let comparer = el => targetOrder - styleBucketOrderingMap[el.getAttribute(DATA_BUCKET_ATTR)];
|
|
10680
|
+
let styleElements = targetDocument.head.querySelectorAll(`[${DATA_BUCKET_ATTR}]`);
|
|
10681
|
+
if (targetBucket === 'm') {
|
|
10682
|
+
const mediaElements = targetDocument.head.querySelectorAll(`[${DATA_BUCKET_ATTR}="${targetBucket}"]`);
|
|
10683
|
+
// only reduce the scope of the search and change comparer
|
|
10684
|
+
// if there are other media buckets already on the page
|
|
10685
|
+
if (mediaElements.length) {
|
|
10686
|
+
styleElements = mediaElements;
|
|
10687
|
+
comparer = el => renderer.compareMediaQueries(media, el.media);
|
|
10688
|
+
}
|
|
10689
|
+
}
|
|
10690
|
+
const comparerWithPriority = el => {
|
|
10691
|
+
if (isSameInsertionKey(el, targetBucket, metadata)) {
|
|
10692
|
+
return priority - Number(el.getAttribute('data-priority'));
|
|
10693
|
+
}
|
|
10694
|
+
return comparer(el);
|
|
10695
|
+
};
|
|
10696
|
+
const length = styleElements.length;
|
|
10697
|
+
let index = length - 1;
|
|
10698
|
+
while (index >= 0) {
|
|
10699
|
+
const styleElement = styleElements.item(index);
|
|
10700
|
+
if (comparerWithPriority(styleElement) > 0) {
|
|
10701
|
+
return styleElement.nextSibling;
|
|
10702
|
+
}
|
|
10703
|
+
index--;
|
|
10704
|
+
}
|
|
10705
|
+
if (length > 0) {
|
|
10706
|
+
return styleElements.item(0);
|
|
10707
|
+
}
|
|
10708
|
+
return insertionPoint ? insertionPoint.nextSibling : null;
|
|
10709
|
+
}
|
|
10710
|
+
|
|
10711
|
+
/**
|
|
10712
|
+
* Suffixes to be ignored in case of error
|
|
10713
|
+
*/
|
|
10714
|
+
const ignoreSuffixes = /*#__PURE__*/['-moz-placeholder', '-moz-focus-inner', '-moz-focusring', '-ms-input-placeholder', '-moz-read-write', '-moz-read-only'].join('|');
|
|
10715
|
+
const ignoreSuffixesRegex = /*#__PURE__*/new RegExp(`:(${ignoreSuffixes})`);
|
|
10716
|
+
/**
|
|
10717
|
+
* @internal
|
|
10718
|
+
*
|
|
10719
|
+
* Calls `sheet.insertRule` and catches errors related to browser prefixes.
|
|
10720
|
+
*/
|
|
10721
|
+
function safeInsertRule(sheet, ruleCSS) {
|
|
10722
|
+
try {
|
|
10723
|
+
sheet.insertRule(ruleCSS);
|
|
10724
|
+
} catch (e) {
|
|
10725
|
+
// We've disabled these warnings due to false-positive errors with browser prefixes
|
|
10726
|
+
if (process.env.NODE_ENV !== 'production' && !ignoreSuffixesRegex.test(ruleCSS)) {
|
|
10727
|
+
// eslint-disable-next-line no-console
|
|
10728
|
+
console.error(`There was a problem inserting the following rule: "${ruleCSS}"`, e);
|
|
10729
|
+
}
|
|
10730
|
+
}
|
|
10731
|
+
}
|
|
10732
|
+
|
|
10760
10733
|
let lastIndex = 0;
|
|
10761
10734
|
/** @internal */
|
|
10762
10735
|
const defaultCompareMediaQueries = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
10763
|
-
|
|
10764
10736
|
/**
|
|
10765
10737
|
* Creates a new instances of a renderer.
|
|
10766
10738
|
*
|
|
@@ -10768,12 +10740,14 @@ const defaultCompareMediaQueries = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
|
10768
10740
|
*/
|
|
10769
10741
|
function createDOMRenderer(targetDocument = typeof document === 'undefined' ? undefined : document, options = {}) {
|
|
10770
10742
|
const {
|
|
10743
|
+
classNameHashSalt,
|
|
10771
10744
|
unstable_filterCSSRule,
|
|
10772
10745
|
insertionPoint,
|
|
10773
10746
|
styleElementAttributes,
|
|
10774
10747
|
compareMediaQueries = defaultCompareMediaQueries
|
|
10775
10748
|
} = options;
|
|
10776
10749
|
const renderer = {
|
|
10750
|
+
classNameHashSalt,
|
|
10777
10751
|
insertionCache: {},
|
|
10778
10752
|
stylesheets: {},
|
|
10779
10753
|
styleElementAttributes: Object.freeze(styleElementAttributes),
|
|
@@ -10783,7 +10757,6 @@ function createDOMRenderer(targetDocument = typeof document === 'undefined' ? un
|
|
|
10783
10757
|
// eslint-disable-next-line guard-for-in
|
|
10784
10758
|
for (const styleBucketName in cssRules) {
|
|
10785
10759
|
const cssRulesForBucket = cssRules[styleBucketName];
|
|
10786
|
-
|
|
10787
10760
|
// This is a hot path in rendering styles: ".length" is cached in "l" var to avoid accesses the property
|
|
10788
10761
|
for (let i = 0, l = cssRulesForBucket.length; i < l; i++) {
|
|
10789
10762
|
const [ruleCSS, metadata] = normalizeCSSBucketEntry(cssRulesForBucket[i]);
|
|
@@ -10812,28 +10785,10 @@ function createDOMRenderer(targetDocument = typeof document === 'undefined' ? un
|
|
|
10812
10785
|
return renderer;
|
|
10813
10786
|
}
|
|
10814
10787
|
|
|
10815
|
-
/**
|
|
10816
|
-
* Default implementation of insertion factory. Inserts styles only once per renderer and performs
|
|
10817
|
-
* insertion immediately after styles computation.
|
|
10818
|
-
*
|
|
10819
|
-
* @internal
|
|
10820
|
-
*/
|
|
10821
|
-
const insertionFactory$1 = () => {
|
|
10822
|
-
const insertionCache = {};
|
|
10823
|
-
return function insertStyles(renderer, cssRules) {
|
|
10824
|
-
if (insertionCache[renderer.id] === undefined) {
|
|
10825
|
-
renderer.insertCSSRules(cssRules);
|
|
10826
|
-
insertionCache[renderer.id] = true;
|
|
10827
|
-
}
|
|
10828
|
-
};
|
|
10829
|
-
};
|
|
10830
|
-
|
|
10831
10788
|
// TODO: duplicated from https://github.com/lahmatiy/react-render-tracker/blob/main/src/publisher/react-integration/utils/stackTrace.ts
|
|
10832
10789
|
// once it is published as a standalone npm package, remove this file
|
|
10833
|
-
|
|
10834
10790
|
// Adopted version of StackTrace-Parser
|
|
10835
10791
|
// https://github.com/errwischt/stacktrace-parser/blob/master/src/stack-trace-parser.js
|
|
10836
|
-
|
|
10837
10792
|
const UNKNOWN_FUNCTION = '<unknown>';
|
|
10838
10793
|
function parseStackTraceLine(line) {
|
|
10839
10794
|
return parseChrome(line) || parseGecko(line) || parseJSC(line);
|
|
@@ -10849,7 +10804,6 @@ function parseChrome(line) {
|
|
|
10849
10804
|
let loc = parts[2];
|
|
10850
10805
|
const isNative = loc && loc.indexOf('native') === 0; // start of line
|
|
10851
10806
|
const isEval = loc && loc.indexOf('eval') === 0; // start of line
|
|
10852
|
-
|
|
10853
10807
|
const submatch = chromeEvalRe.exec(loc);
|
|
10854
10808
|
if (isEval && submatch != null) {
|
|
10855
10809
|
// throw out eval line/column and use top-most line/column number
|
|
@@ -10898,7 +10852,7 @@ function getSourceURLfromError() {
|
|
|
10898
10852
|
return undefined;
|
|
10899
10853
|
}
|
|
10900
10854
|
const result = parseStackTraceLine(userMakeStyleCallLine);
|
|
10901
|
-
return result
|
|
10855
|
+
return result === null || result === void 0 ? void 0 : result.loc;
|
|
10902
10856
|
}
|
|
10903
10857
|
function findUserMakeStyleCallInStacks(stacks) {
|
|
10904
10858
|
for (let i = stacks.length - 1; i >= 0; --i) {
|
|
@@ -10914,6 +10868,22 @@ function findUserMakeStyleCallInStacks(stacks) {
|
|
|
10914
10868
|
return undefined;
|
|
10915
10869
|
}
|
|
10916
10870
|
|
|
10871
|
+
/**
|
|
10872
|
+
* Default implementation of insertion factory. Inserts styles only once per renderer and performs
|
|
10873
|
+
* insertion immediately after styles computation.
|
|
10874
|
+
*
|
|
10875
|
+
* @internal
|
|
10876
|
+
*/
|
|
10877
|
+
const insertionFactory$1 = () => {
|
|
10878
|
+
const insertionCache = {};
|
|
10879
|
+
return function insertStyles(renderer, cssRules) {
|
|
10880
|
+
if (insertionCache[renderer.id] === undefined) {
|
|
10881
|
+
renderer.insertCSSRules(cssRules);
|
|
10882
|
+
insertionCache[renderer.id] = true;
|
|
10883
|
+
}
|
|
10884
|
+
};
|
|
10885
|
+
};
|
|
10886
|
+
|
|
10917
10887
|
/**
|
|
10918
10888
|
* A version of makeStyles() that accepts build output as an input and skips all runtime transforms.
|
|
10919
10889
|
*
|
|
@@ -11008,7 +10978,6 @@ const insertionFactory = () => {
|
|
|
11008
10978
|
* @private
|
|
11009
10979
|
*/
|
|
11010
10980
|
const RendererContext = /*#__PURE__*/React.createContext( /*#__PURE__*/createDOMRenderer());
|
|
11011
|
-
|
|
11012
10981
|
/**
|
|
11013
10982
|
* Returns an instance of current makeStyles() renderer.
|
|
11014
10983
|
*
|
|
@@ -11022,7 +10991,6 @@ function useRenderer() {
|
|
|
11022
10991
|
* @private
|
|
11023
10992
|
*/
|
|
11024
10993
|
const TextDirectionContext = /*#__PURE__*/React.createContext('ltr');
|
|
11025
|
-
|
|
11026
10994
|
/**
|
|
11027
10995
|
* Returns current directionality of the element's text.
|
|
11028
10996
|
*
|
|
@@ -12808,7 +12776,7 @@ const renderCheckbox_unstable = (state)=>{
|
|
|
12808
12776
|
children: [
|
|
12809
12777
|
/*#__PURE__*/ jsx(state.input, {}),
|
|
12810
12778
|
state.labelPosition === 'before' && state.label && /*#__PURE__*/ jsx(state.label, {}),
|
|
12811
|
-
/*#__PURE__*/ jsx(state.indicator, {}),
|
|
12779
|
+
state.indicator && /*#__PURE__*/ jsx(state.indicator, {}),
|
|
12812
12780
|
state.labelPosition === 'after' && state.label && /*#__PURE__*/ jsx(state.label, {})
|
|
12813
12781
|
]
|
|
12814
12782
|
});
|
|
@@ -31259,8 +31227,13 @@ const diagnostics = {
|
|
|
31259
31227
|
unassignable: {
|
|
31260
31228
|
severity: "error",
|
|
31261
31229
|
messages: {
|
|
31262
|
-
default: paramMessage `Type '${"
|
|
31263
|
-
|
|
31230
|
+
default: paramMessage `Type '${"sourceType"}' is not assignable to type '${"targetType"}'`,
|
|
31231
|
+
},
|
|
31232
|
+
},
|
|
31233
|
+
"property-unassignable": {
|
|
31234
|
+
severity: "error",
|
|
31235
|
+
messages: {
|
|
31236
|
+
default: paramMessage `Types of property '${"propName"}' are incompatible`,
|
|
31264
31237
|
},
|
|
31265
31238
|
},
|
|
31266
31239
|
"property-required": {
|
|
@@ -38807,7 +38780,7 @@ let manifest;
|
|
|
38807
38780
|
try {
|
|
38808
38781
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
38809
38782
|
// @ts-ignore
|
|
38810
|
-
manifest = (await import('../manifest-
|
|
38783
|
+
manifest = (await import('../manifest-onl5D1yL-onl5D1yL.js')).default;
|
|
38811
38784
|
}
|
|
38812
38785
|
catch {
|
|
38813
38786
|
const name = "../dist/manifest.js";
|
|
@@ -40445,7 +40418,7 @@ function parse$1(original) {
|
|
|
40445
40418
|
let sign = 1;
|
|
40446
40419
|
let n;
|
|
40447
40420
|
let exp;
|
|
40448
|
-
let decimal;
|
|
40421
|
+
let decimal = undefined;
|
|
40449
40422
|
if (stringValue[0] === "-") {
|
|
40450
40423
|
start = 1;
|
|
40451
40424
|
sign = -1;
|
|
@@ -40481,6 +40454,7 @@ function parse$1(original) {
|
|
|
40481
40454
|
}
|
|
40482
40455
|
exp += Number(stringValue.slice(i + 1));
|
|
40483
40456
|
stringValue = stringValue.slice(start, i);
|
|
40457
|
+
decimal = Math.max(stringValue.length - exp, 0);
|
|
40484
40458
|
}
|
|
40485
40459
|
else if (exp === undefined) {
|
|
40486
40460
|
// Integer.
|
|
@@ -40494,11 +40468,24 @@ function parse$1(original) {
|
|
|
40494
40468
|
while (stringValue[end - 1] === "0" && end > adjustedPointIndex) {
|
|
40495
40469
|
end--;
|
|
40496
40470
|
}
|
|
40471
|
+
// Only if there is 0 before the decimal point, keeps checking how many 0 there is after it and update the exponent accordingly.
|
|
40472
|
+
if (start === adjustedPointIndex + 1) {
|
|
40473
|
+
let cur = adjustedPointIndex;
|
|
40474
|
+
while (stringValue[cur] === "0" && cur < end) {
|
|
40475
|
+
cur++;
|
|
40476
|
+
exp--;
|
|
40477
|
+
}
|
|
40478
|
+
}
|
|
40497
40479
|
try {
|
|
40498
40480
|
stringValue = stringValue.slice(0, end);
|
|
40499
40481
|
stringValue = stringValue + "0".repeat(Math.max(exp - stringValue.length, 0)); // add remaining zeros for cases like 3e30
|
|
40500
40482
|
n = BigInt(stringValue);
|
|
40501
|
-
|
|
40483
|
+
if (n === 0n) {
|
|
40484
|
+
decimal = 0;
|
|
40485
|
+
}
|
|
40486
|
+
else if (decimal === undefined) {
|
|
40487
|
+
decimal = Math.max(stringValue.length - Math.max(exp, 0), 0);
|
|
40488
|
+
}
|
|
40502
40489
|
}
|
|
40503
40490
|
catch {
|
|
40504
40491
|
throw new InvalidNumericError(`Invalid numeric value: ${original}`);
|
|
@@ -40511,8 +40498,8 @@ function stringify(value) {
|
|
|
40511
40498
|
return "0";
|
|
40512
40499
|
const n = value.n.toString();
|
|
40513
40500
|
const sign = value.s === -1 ? "-" : "";
|
|
40514
|
-
const int = value.e
|
|
40515
|
-
const decimal = value.e < n.length ? "." + n.slice(value.
|
|
40501
|
+
const int = value.e <= 0 ? "0" : n.slice(0, value.e);
|
|
40502
|
+
const decimal = value.e < n.length ? "." + n.slice(-value.d).padStart(value.d, "0") : "";
|
|
40516
40503
|
return sign + int + decimal;
|
|
40517
40504
|
}
|
|
40518
40505
|
const equals = (a, b) => a.n === b.n && a.e === b.e;
|
|
@@ -40610,6 +40597,7 @@ var Related;
|
|
|
40610
40597
|
Related[Related["true"] = 1] = "true";
|
|
40611
40598
|
Related[Related["maybe"] = 2] = "maybe";
|
|
40612
40599
|
})(Related || (Related = {}));
|
|
40600
|
+
// #endregion
|
|
40613
40601
|
|
|
40614
40602
|
var ResolutionKind;
|
|
40615
40603
|
(function (ResolutionKind) {
|
|
@@ -41931,6 +41919,41 @@ new Set([
|
|
|
41931
41919
|
"intrinsic",
|
|
41932
41920
|
]);
|
|
41933
41921
|
|
|
41922
|
+
let currentProgram;
|
|
41923
|
+
/** @experimental */
|
|
41924
|
+
const TypekitPrototype = {};
|
|
41925
|
+
/** @experimental */
|
|
41926
|
+
function createTypekit() {
|
|
41927
|
+
const tk = Object.create(TypekitPrototype);
|
|
41928
|
+
Object.defineProperty(tk, "program", {
|
|
41929
|
+
get() {
|
|
41930
|
+
return currentProgram;
|
|
41931
|
+
},
|
|
41932
|
+
});
|
|
41933
|
+
const handler = {
|
|
41934
|
+
get(target, prop, receiver) {
|
|
41935
|
+
const value = Reflect.get(target, prop, receiver);
|
|
41936
|
+
if (prop === "program") {
|
|
41937
|
+
// don't wrap program (probably need to ensure this isn't a nested program somewhere)
|
|
41938
|
+
return value;
|
|
41939
|
+
}
|
|
41940
|
+
if (typeof value === "function") {
|
|
41941
|
+
return function (...args) {
|
|
41942
|
+
return value.apply(proxy, args);
|
|
41943
|
+
};
|
|
41944
|
+
}
|
|
41945
|
+
if (typeof value === "object" && value !== null) {
|
|
41946
|
+
return new Proxy(value, handler);
|
|
41947
|
+
}
|
|
41948
|
+
return value;
|
|
41949
|
+
},
|
|
41950
|
+
};
|
|
41951
|
+
const proxy = new Proxy(tk, handler);
|
|
41952
|
+
return proxy;
|
|
41953
|
+
}
|
|
41954
|
+
/** @experimental */
|
|
41955
|
+
createTypekit();
|
|
41956
|
+
|
|
41934
41957
|
const globalLibraryUrlsLoadedSym = Symbol.for("TYPESPEC_LIBRARY_URLS_LOADED");
|
|
41935
41958
|
if (globalThis[globalLibraryUrlsLoadedSym] === undefined) {
|
|
41936
41959
|
globalThis[globalLibraryUrlsLoadedSym] = new Set();
|