@typespec/playground 0.5.0-dev.5 → 0.5.0-dev.7

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.
@@ -1,6 +1,6 @@
1
1
  const manifest = {
2
2
  "version": "0.60.1",
3
- "commit": "66e847c71be174f2c789307a7ccb32306d1ca8ba"
3
+ "commit": "bcee728da09cca02f0065b39da9e3665971dc7ed"
4
4
  };
5
5
 
6
6
  export { manifest as default };
@@ -9553,7 +9553,7 @@ class TabsterCore {
9553
9553
  this._forgetMemorizedElements = [];
9554
9554
  this._wrappers = new Set();
9555
9555
  this._initQueue = [];
9556
- this._version = "8.0.1";
9556
+ this._version = "8.1.0";
9557
9557
  this._noop = false;
9558
9558
 
9559
9559
  this.getWindow = () => {
@@ -10138,29 +10138,11 @@ function isHTMLElement(target) {
10138
10138
  ]);
10139
10139
  };
10140
10140
 
10141
- /**
10142
- * @internal
10143
- *
10144
- * @param entry - CSS bucket entry that can be either a string or an array
10145
- * @returns An array where the first element is the CSS rule
10146
- */
10147
- function normalizeCSSBucketEntry(entry) {
10148
- if (!Array.isArray(entry)) {
10149
- return [entry];
10150
- }
10151
- if (process.env.NODE_ENV !== 'production' && entry.length > 2) {
10152
- throw new Error('CSS Bucket contains an entry with greater than 2 items, please report this to https://github.com/microsoft/griffel/issues');
10153
- }
10154
- return entry;
10155
- }
10156
-
10157
10141
  // ----
10158
-
10159
10142
  // Heads up!
10160
10143
  // These constants are global and will be shared between Griffel instances.
10161
10144
  // Any change in them should happen only in a MAJOR version. If it happens,
10162
10145
  // please change "__NAMESPACE_PREFIX__" to include a version.
10163
-
10164
10146
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10165
10147
  const __GLOBAL__ = typeof window === 'undefined' ? global : window;
10166
10148
  const __NAMESPACE_PREFIX__ = '@griffel/';
@@ -10170,232 +10152,31 @@ function getGlobalVar(name, defaultValue) {
10170
10152
  }
10171
10153
  return __GLOBAL__[Symbol.for(__NAMESPACE_PREFIX__ + name)];
10172
10154
  }
10173
-
10174
10155
  /** @internal */
10175
10156
  const DEBUG_RESET_CLASSES = /*#__PURE__*/getGlobalVar('DEBUG_RESET_CLASSES', {});
10176
-
10177
10157
  /** @internal */
10178
10158
  const DEFINITION_LOOKUP_TABLE = /*#__PURE__*/getGlobalVar('DEFINITION_LOOKUP_TABLE', {});
10179
-
10180
10159
  // ----
10181
-
10182
10160
  /** @internal */
10183
10161
  const DATA_BUCKET_ATTR = 'data-make-styles-bucket';
10184
-
10185
10162
  /** @internal */
10186
10163
  const DATA_PRIORITY_ATTR = 'data-priority';
10187
-
10188
10164
  /** @internal */
10189
10165
  const RESET_HASH_PREFIX = 'r';
10190
-
10191
10166
  /** @internal */
10192
10167
  const SEQUENCE_HASH_LENGTH = 7;
10193
-
10194
10168
  /** @internal */
10195
10169
  const SEQUENCE_PREFIX = '___';
10196
-
10197
10170
  /** @internal */
10198
10171
  const DEBUG_SEQUENCE_SEPARATOR = '_';
10199
-
10200
10172
  /** @internal */
10201
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;
10202
-
10203
10174
  // indexes for values in LookupItem tuple
10204
-
10205
10175
  /** @internal */
10206
10176
  const LOOKUP_DEFINITIONS_INDEX = 0;
10207
-
10208
10177
  /** @internal */
10209
10178
  const LOOKUP_DIR_INDEX = 1;
10210
10179
 
10211
- function createIsomorphicStyleSheet(styleElement, bucketName, priority, elementAttributes) {
10212
- // no CSSStyleSheet in SSR, just append rules here for server render
10213
- const __cssRulesForSSR = [];
10214
- elementAttributes[DATA_BUCKET_ATTR] = bucketName;
10215
- elementAttributes[DATA_PRIORITY_ATTR] = String(priority);
10216
- if (styleElement) {
10217
- for (const attrName in elementAttributes) {
10218
- styleElement.setAttribute(attrName, elementAttributes[attrName]);
10219
- }
10220
- }
10221
- function insertRule(rule) {
10222
- if (styleElement != null && styleElement.sheet) {
10223
- return styleElement.sheet.insertRule(rule, styleElement.sheet.cssRules.length);
10224
- }
10225
- return __cssRulesForSSR.push(rule);
10226
- }
10227
- return {
10228
- elementAttributes,
10229
- insertRule,
10230
- element: styleElement,
10231
- bucketName,
10232
- cssRules() {
10233
- if (styleElement != null && styleElement.sheet) {
10234
- return Array.from(styleElement.sheet.cssRules).map(cssRule => cssRule.cssText);
10235
- }
10236
- return __cssRulesForSSR;
10237
- }
10238
- };
10239
- }
10240
-
10241
- /**
10242
- * Ordered style buckets using their short pseudo name.
10243
- *
10244
- * @internal
10245
- */
10246
- const styleBucketOrdering = [
10247
- // reset styles
10248
- 'r',
10249
- // catch-all
10250
- 'd',
10251
- // link
10252
- 'l',
10253
- // visited
10254
- 'v',
10255
- // focus-within
10256
- 'w',
10257
- // focus
10258
- 'f',
10259
- // focus-visible
10260
- 'i',
10261
- // hover
10262
- 'h',
10263
- // active
10264
- 'a',
10265
- // at rules for reset styles
10266
- 's',
10267
- // keyframes
10268
- 'k',
10269
- // at-rules
10270
- 't',
10271
- // @media rules
10272
- 'm',
10273
- // @container rules
10274
- 'c'];
10275
-
10276
- // avoid repeatedly calling `indexOf` to determine order during new insertions
10277
- const styleBucketOrderingMap = /*#__PURE__*/styleBucketOrdering.reduce((acc, cur, j) => {
10278
- acc[cur] = j;
10279
- return acc;
10280
- }, {});
10281
- function getStyleSheetKey(bucketName, media, priority) {
10282
- return (bucketName === 'm' ? bucketName + media : bucketName) + priority;
10283
- }
10284
-
10285
- /**
10286
- * Lazily adds a `<style>` bucket to the `<head>`. This will ensure that the style buckets are ordered.
10287
- */
10288
- function getStyleSheetForBucket(bucketName, targetDocument, insertionPoint, renderer, metadata = {}) {
10289
- var _ref, _ref2;
10290
- const isMediaBucket = bucketName === 'm';
10291
- const media = (_ref = metadata['m']) != null ? _ref : '0';
10292
- const priority = (_ref2 = metadata['p']) != null ? _ref2 : 0;
10293
- const stylesheetKey = getStyleSheetKey(bucketName, media, priority);
10294
- if (!renderer.stylesheets[stylesheetKey]) {
10295
- const tag = targetDocument && targetDocument.createElement('style');
10296
- const stylesheet = createIsomorphicStyleSheet(tag, bucketName, priority, Object.assign({}, renderer.styleElementAttributes, isMediaBucket && {
10297
- media
10298
- }));
10299
- renderer.stylesheets[stylesheetKey] = stylesheet;
10300
- if (targetDocument && tag) {
10301
- targetDocument.head.insertBefore(tag, findInsertionPoint(targetDocument, insertionPoint, bucketName, renderer, metadata));
10302
- }
10303
- }
10304
- return renderer.stylesheets[stylesheetKey];
10305
- }
10306
- function isSameInsertionKey(element, bucketName, metadata) {
10307
- var _ref3, _element$media;
10308
- const targetKey = bucketName + ((_ref3 = metadata['m']) != null ? _ref3 : '');
10309
- const elementKey = element.getAttribute(DATA_BUCKET_ATTR) + ((_element$media = element.media) != null ? _element$media : '');
10310
- return targetKey === elementKey;
10311
- }
10312
-
10313
- /**
10314
- * Finds an element before which the new bucket style element should be inserted following the bucket sort order.
10315
- *
10316
- * @param targetDocument - A document
10317
- * @param insertionPoint - An element that will be used as an initial insertion point
10318
- * @param targetBucket - The bucket that should be inserted to DOM
10319
- * @param renderer - Griffel renderer
10320
- * @param metadata - metadata for CSS rule
10321
- * @returns - Smallest style element with greater sort order than the current bucket
10322
- */
10323
- function findInsertionPoint(targetDocument, insertionPoint, targetBucket, renderer, metadata = {}) {
10324
- var _ref4, _ref5;
10325
- const targetOrder = styleBucketOrderingMap[targetBucket];
10326
- const media = (_ref4 = metadata['m']) != null ? _ref4 : '';
10327
- const priority = (_ref5 = metadata['p']) != null ? _ref5 : 0;
10328
-
10329
- // Similar to javascript sort comparators where
10330
- // a positive value is increasing sort order
10331
- // a negative value is decreasing sort order
10332
- let comparer = el => targetOrder - styleBucketOrderingMap[el.getAttribute(DATA_BUCKET_ATTR)];
10333
- let styleElements = targetDocument.head.querySelectorAll(`[${DATA_BUCKET_ATTR}]`);
10334
- if (targetBucket === 'm') {
10335
- const mediaElements = targetDocument.head.querySelectorAll(`[${DATA_BUCKET_ATTR}="${targetBucket}"]`);
10336
-
10337
- // only reduce the scope of the search and change comparer
10338
- // if there are other media buckets already on the page
10339
- if (mediaElements.length) {
10340
- styleElements = mediaElements;
10341
- comparer = el => renderer.compareMediaQueries(media, el.media);
10342
- }
10343
- }
10344
- const comparerWithPriority = el => {
10345
- if (isSameInsertionKey(el, targetBucket, metadata)) {
10346
- return priority - Number(el.getAttribute('data-priority'));
10347
- }
10348
- return comparer(el);
10349
- };
10350
- const length = styleElements.length;
10351
- let index = length - 1;
10352
- while (index >= 0) {
10353
- const styleElement = styleElements.item(index);
10354
- if (comparerWithPriority(styleElement) > 0) {
10355
- return styleElement.nextSibling;
10356
- }
10357
- index--;
10358
- }
10359
- if (length > 0) {
10360
- return styleElements.item(0);
10361
- }
10362
- return insertionPoint ? insertionPoint.nextSibling : null;
10363
- }
10364
-
10365
- /**
10366
- * Suffixes to be ignored in case of error
10367
- */
10368
- const ignoreSuffixes = /*#__PURE__*/['-moz-placeholder', '-moz-focus-inner', '-moz-focusring', '-ms-input-placeholder', '-moz-read-write', '-moz-read-only'].join('|');
10369
- const ignoreSuffixesRegex = /*#__PURE__*/new RegExp(`:(${ignoreSuffixes})`);
10370
-
10371
- /**
10372
- * @internal
10373
- *
10374
- * Calls `sheet.insertRule` and catches errors related to browser prefixes.
10375
- */
10376
- function safeInsertRule(sheet, ruleCSS) {
10377
- try {
10378
- sheet.insertRule(ruleCSS);
10379
- } catch (e) {
10380
- // We've disabled these warnings due to false-positive errors with browser prefixes
10381
- if (process.env.NODE_ENV !== 'production' && !ignoreSuffixesRegex.test(ruleCSS)) {
10382
- // eslint-disable-next-line no-console
10383
- console.error(`There was a problem inserting the following rule: "${ruleCSS}"`, e);
10384
- }
10385
- }
10386
- }
10387
-
10388
- const isDevToolsEnabled = /*#__PURE__*/(() => {
10389
- // Accessing "window.sessionStorage" causes an exception when third party cookies are blocked
10390
- // https://stackoverflow.com/questions/30481516/iframe-in-chrome-error-failed-to-read-localstorage-from-window-access-deni
10391
- try {
10392
- var _window$sessionStorag;
10393
- return Boolean(typeof window !== 'undefined' && ((_window$sessionStorag = window.sessionStorage) == null ? void 0 : _window$sessionStorag.getItem('__GRIFFEL_DEVTOOLS__')));
10394
- } catch (e) {
10395
- return false;
10396
- }
10397
- })();
10398
-
10399
10180
  /* eslint-disable */
10400
10181
  // Inspired by https://github.com/garycourt/murmurhash-js
10401
10182
  // Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
@@ -10479,7 +10260,6 @@ function reduceToClassName(classMap, dir) {
10479
10260
  // `hashString` is needed to handle `null` values in a class map as they don't produce any classes.
10480
10261
  let classString = '';
10481
10262
  let hashString = '';
10482
-
10483
10263
  // eslint-disable-next-line guard-for-in
10484
10264
  for (const propertyHash in classMap) {
10485
10265
  const classNameMapping = classMap[propertyHash];
@@ -10494,7 +10274,6 @@ function reduceToClassName(classMap, dir) {
10494
10274
  }
10495
10275
  return [classString.slice(0, -1), hashString.slice(0, -1)];
10496
10276
  }
10497
-
10498
10277
  /**
10499
10278
  * Reduces classname maps for slots to classname strings. Registers them in a definition cache to be used by
10500
10279
  * `mergeClasses()`.
@@ -10503,11 +10282,9 @@ function reduceToClassName(classMap, dir) {
10503
10282
  */
10504
10283
  function reduceToClassNameForSlots(classesMapBySlot, dir) {
10505
10284
  const classNamesForSlots = {};
10506
-
10507
10285
  // eslint-disable-next-line guard-for-in
10508
10286
  for (const slotName in classesMapBySlot) {
10509
10287
  const [slotClasses, slotClassesHash] = reduceToClassName(classesMapBySlot[slotName], dir);
10510
-
10511
10288
  // Handles a case when there are no classes in a set i.e. "makeStyles({ root: {} })"
10512
10289
  if (slotClassesHash === '') {
10513
10290
  classNamesForSlots[slotName] = '';
@@ -10523,33 +10300,12 @@ function reduceToClassNameForSlots(classesMapBySlot, dir) {
10523
10300
 
10524
10301
  // Contains a mapping of previously resolved sequences of atomic classnames
10525
10302
  const mergeClassesCachedResults = {};
10526
-
10527
- /**
10528
- * Function can take any number of arguments, joins classes together and deduplicates atomic declarations generated by
10529
- * `makeStyles()`. Handles scoped directional styles.
10530
- *
10531
- * Classnames can be of any length, this function can take both atomic declarations and class names.
10532
- *
10533
- * Input:
10534
- * ```
10535
- * // not real classes
10536
- * mergeClasses('ui-button', 'displayflex', 'displaygrid')
10537
- * ```
10538
- *
10539
- * Output:
10540
- * ```
10541
- * 'ui-button displaygrid'
10542
- * ```
10543
- */
10544
-
10545
10303
  function mergeClasses() {
10546
10304
  // arguments are parsed manually to avoid double loops as TS & Babel transforms rest via an additional loop
10547
10305
  // @see https://babeljs.io/docs/en/babel-plugin-transform-parameters
10548
10306
  /* eslint-disable prefer-rest-params */
10549
-
10550
10307
  let dir = null;
10551
10308
  let resultClassName = '';
10552
-
10553
10309
  // Is used as a cache key to avoid object merging
10554
10310
  let sequenceMatch = '';
10555
10311
  const sequencesIds = new Array(arguments.length);
@@ -10576,7 +10332,6 @@ function mergeClasses() {
10576
10332
  resultClassName += className + ' ';
10577
10333
  } else {
10578
10334
  const sequenceId = className.substr(sequenceIndex, SEQUENCE_SIZE);
10579
-
10580
10335
  // Handles a case with mixed classnames, i.e. "ui-button ATOMIC_CLASSES"
10581
10336
  if (sequenceIndex > 0) {
10582
10337
  resultClassName += className.slice(0, sequenceIndex);
@@ -10592,13 +10347,11 @@ function mergeClasses() {
10592
10347
  }
10593
10348
  }
10594
10349
  }
10595
-
10596
10350
  // .slice() there allows to avoid trailing space for non-atomic classes
10597
10351
  // "ui-button ui-flex " => "ui-button ui-flex"
10598
10352
  if (sequenceMatch === '') {
10599
10353
  return resultClassName.slice(0, -1);
10600
10354
  }
10601
-
10602
10355
  // It's safe to reuse results to avoid continuous merging as results are stable
10603
10356
  // "__seq1 ... __seq2 ..." => "__seq12 ..."
10604
10357
  const mergeClassesResult = mergeClassesCachedResults[sequenceMatch];
@@ -10627,13 +10380,11 @@ function mergeClasses() {
10627
10380
  }
10628
10381
  }
10629
10382
  }
10630
-
10631
10383
  // eslint-disable-next-line prefer-spread
10632
10384
  const resultClassesMap = Object.assign.apply(Object,
10633
10385
  // .assign() mutates the first object, we can't mutate mappings as it will produce invalid results later
10634
10386
  [{}].concat(sequenceMappings));
10635
10387
  const [atomicClasses, classesMapHash] = reduceToClassName(resultClassesMap, dir);
10636
-
10637
10388
  // Each merge of classes generates a new sequence of atomic classes that needs to be registered
10638
10389
  const newSequenceHash = hashSequence(classesMapHash, dir, sequencesIds);
10639
10390
  const newClassName = newSequenceHash + ' ' + atomicClasses;
@@ -10723,7 +10474,7 @@ function getDebugTree(debugSequenceHash, parentNode) {
10723
10474
  return undefined;
10724
10475
  }
10725
10476
  const parentLookupItem = parentNode ? DEFINITION_LOOKUP_TABLE[parentNode.sequenceHash] : undefined;
10726
- const debugClassNames = getDebugClassNames(lookupItem, parentLookupItem, parentNode == null ? void 0 : parentNode.debugClassNames, parentNode == null ? void 0 : parentNode.children);
10477
+ const debugClassNames = getDebugClassNames(lookupItem, parentLookupItem, parentNode === null || parentNode === void 0 ? void 0 : parentNode.debugClassNames, parentNode === null || parentNode === void 0 ? void 0 : parentNode.children);
10727
10478
  const node = {
10728
10479
  sequenceHash: debugSequenceHash,
10729
10480
  direction: lookupItem[1],
@@ -10738,7 +10489,6 @@ function getDebugTree(debugSequenceHash, parentNode) {
10738
10489
  node.children.push(child);
10739
10490
  }
10740
10491
  });
10741
-
10742
10492
  // if it's leaf (makeStyle node), get css rules
10743
10493
  if (!node.children.length) {
10744
10494
  node.rules = {};
@@ -10782,10 +10532,207 @@ function injectDevTools(document) {
10782
10532
  });
10783
10533
  }
10784
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
+
10785
10733
  let lastIndex = 0;
10786
10734
  /** @internal */
10787
10735
  const defaultCompareMediaQueries = (a, b) => a < b ? -1 : a > b ? 1 : 0;
10788
-
10789
10736
  /**
10790
10737
  * Creates a new instances of a renderer.
10791
10738
  *
@@ -10793,12 +10740,14 @@ const defaultCompareMediaQueries = (a, b) => a < b ? -1 : a > b ? 1 : 0;
10793
10740
  */
10794
10741
  function createDOMRenderer(targetDocument = typeof document === 'undefined' ? undefined : document, options = {}) {
10795
10742
  const {
10743
+ classNameHashSalt,
10796
10744
  unstable_filterCSSRule,
10797
10745
  insertionPoint,
10798
10746
  styleElementAttributes,
10799
10747
  compareMediaQueries = defaultCompareMediaQueries
10800
10748
  } = options;
10801
10749
  const renderer = {
10750
+ classNameHashSalt,
10802
10751
  insertionCache: {},
10803
10752
  stylesheets: {},
10804
10753
  styleElementAttributes: Object.freeze(styleElementAttributes),
@@ -10808,7 +10757,6 @@ function createDOMRenderer(targetDocument = typeof document === 'undefined' ? un
10808
10757
  // eslint-disable-next-line guard-for-in
10809
10758
  for (const styleBucketName in cssRules) {
10810
10759
  const cssRulesForBucket = cssRules[styleBucketName];
10811
-
10812
10760
  // This is a hot path in rendering styles: ".length" is cached in "l" var to avoid accesses the property
10813
10761
  for (let i = 0, l = cssRulesForBucket.length; i < l; i++) {
10814
10762
  const [ruleCSS, metadata] = normalizeCSSBucketEntry(cssRulesForBucket[i]);
@@ -10837,28 +10785,10 @@ function createDOMRenderer(targetDocument = typeof document === 'undefined' ? un
10837
10785
  return renderer;
10838
10786
  }
10839
10787
 
10840
- /**
10841
- * Default implementation of insertion factory. Inserts styles only once per renderer and performs
10842
- * insertion immediately after styles computation.
10843
- *
10844
- * @internal
10845
- */
10846
- const insertionFactory$1 = () => {
10847
- const insertionCache = {};
10848
- return function insertStyles(renderer, cssRules) {
10849
- if (insertionCache[renderer.id] === undefined) {
10850
- renderer.insertCSSRules(cssRules);
10851
- insertionCache[renderer.id] = true;
10852
- }
10853
- };
10854
- };
10855
-
10856
10788
  // TODO: duplicated from https://github.com/lahmatiy/react-render-tracker/blob/main/src/publisher/react-integration/utils/stackTrace.ts
10857
10789
  // once it is published as a standalone npm package, remove this file
10858
-
10859
10790
  // Adopted version of StackTrace-Parser
10860
10791
  // https://github.com/errwischt/stacktrace-parser/blob/master/src/stack-trace-parser.js
10861
-
10862
10792
  const UNKNOWN_FUNCTION = '<unknown>';
10863
10793
  function parseStackTraceLine(line) {
10864
10794
  return parseChrome(line) || parseGecko(line) || parseJSC(line);
@@ -10874,7 +10804,6 @@ function parseChrome(line) {
10874
10804
  let loc = parts[2];
10875
10805
  const isNative = loc && loc.indexOf('native') === 0; // start of line
10876
10806
  const isEval = loc && loc.indexOf('eval') === 0; // start of line
10877
-
10878
10807
  const submatch = chromeEvalRe.exec(loc);
10879
10808
  if (isEval && submatch != null) {
10880
10809
  // throw out eval line/column and use top-most line/column number
@@ -10923,7 +10852,7 @@ function getSourceURLfromError() {
10923
10852
  return undefined;
10924
10853
  }
10925
10854
  const result = parseStackTraceLine(userMakeStyleCallLine);
10926
- return result == null ? void 0 : result.loc;
10855
+ return result === null || result === void 0 ? void 0 : result.loc;
10927
10856
  }
10928
10857
  function findUserMakeStyleCallInStacks(stacks) {
10929
10858
  for (let i = stacks.length - 1; i >= 0; --i) {
@@ -10939,6 +10868,22 @@ function findUserMakeStyleCallInStacks(stacks) {
10939
10868
  return undefined;
10940
10869
  }
10941
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
+
10942
10887
  /**
10943
10888
  * A version of makeStyles() that accepts build output as an input and skips all runtime transforms.
10944
10889
  *
@@ -11033,7 +10978,6 @@ const insertionFactory = () => {
11033
10978
  * @private
11034
10979
  */
11035
10980
  const RendererContext = /*#__PURE__*/React.createContext( /*#__PURE__*/createDOMRenderer());
11036
-
11037
10981
  /**
11038
10982
  * Returns an instance of current makeStyles() renderer.
11039
10983
  *
@@ -11047,7 +10991,6 @@ function useRenderer() {
11047
10991
  * @private
11048
10992
  */
11049
10993
  const TextDirectionContext = /*#__PURE__*/React.createContext('ltr');
11050
-
11051
10994
  /**
11052
10995
  * Returns current directionality of the element's text.
11053
10996
  *
@@ -38837,7 +38780,7 @@ let manifest;
38837
38780
  try {
38838
38781
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
38839
38782
  // @ts-ignore
38840
- manifest = (await import('../manifest-CNmB2KUS-CNmB2KUS.js')).default;
38783
+ manifest = (await import('../manifest-BZHVPNKg-BZHVPNKg.js')).default;
38841
38784
  }
38842
38785
  catch {
38843
38786
  const name = "../dist/manifest.js";
@@ -40556,7 +40499,7 @@ function stringify(value) {
40556
40499
  const n = value.n.toString();
40557
40500
  const sign = value.s === -1 ? "-" : "";
40558
40501
  const int = value.e <= 0 ? "0" : n.slice(0, value.e);
40559
- const decimal = value.e < n.length ? "." + n.slice(value.e).padStart(value.d, "0") : "";
40502
+ const decimal = value.e < n.length ? "." + n.slice(-value.d).padStart(value.d, "0") : "";
40560
40503
  return sign + int + decimal;
40561
40504
  }
40562
40505
  const equals = (a, b) => a.n === b.n && a.e === b.e;
@@ -41976,6 +41919,41 @@ new Set([
41976
41919
  "intrinsic",
41977
41920
  ]);
41978
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
+
41979
41957
  const globalLibraryUrlsLoadedSym = Symbol.for("TYPESPEC_LIBRARY_URLS_LOADED");
41980
41958
  if (globalThis[globalLibraryUrlsLoadedSym] === undefined) {
41981
41959
  globalThis[globalLibraryUrlsLoadedSym] = new Set();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/playground",
3
- "version": "0.5.0-dev.5",
3
+ "version": "0.5.0-dev.7",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec playground UI components.",
6
6
  "homepage": "https://typespec.io",
@@ -55,7 +55,7 @@
55
55
  "!dist/test/**"
56
56
  ],
57
57
  "dependencies": {
58
- "@fluentui/react-components": "~9.54.15",
58
+ "@fluentui/react-components": "~9.54.16",
59
59
  "@fluentui/react-icons": "^2.0.258",
60
60
  "@typespec/bundler": "~0.1.7 || >=0.2.0-dev <0.2.0",
61
61
  "@typespec/compiler": "~0.60.1 || >=0.61.0-dev <0.61.0",
@@ -69,7 +69,7 @@
69
69
  "clsx": "^2.1.1",
70
70
  "debounce": "~2.1.1",
71
71
  "lzutf8": "0.6.3",
72
- "monaco-editor": "~0.46.0",
72
+ "monaco-editor": "~0.52.0",
73
73
  "react": "~18.3.1",
74
74
  "react-dom": "~18.3.1",
75
75
  "react-error-boundary": "^4.0.13",
@@ -79,16 +79,16 @@
79
79
  },
80
80
  "devDependencies": {
81
81
  "@babel/core": "^7.25.2",
82
- "@playwright/test": "^1.47.0",
83
- "@storybook/addon-actions": "^8.3.0",
84
- "@storybook/cli": "^8.3.0",
85
- "@storybook/react": "^8.3.0",
86
- "@storybook/react-vite": "^8.3.0",
87
- "@storybook/test": "^8.3.0",
88
- "@storybook/types": "^8.3.0",
82
+ "@playwright/test": "^1.47.2",
83
+ "@storybook/addon-actions": "^8.3.3",
84
+ "@storybook/cli": "^8.3.3",
85
+ "@storybook/react": "^8.3.3",
86
+ "@storybook/react-vite": "^8.3.3",
87
+ "@storybook/test": "^8.3.3",
88
+ "@storybook/types": "^8.3.3",
89
89
  "@types/debounce": "~1.2.4",
90
- "@types/node": "~22.5.4",
91
- "@types/react": "~18.3.5",
90
+ "@types/node": "~22.7.1",
91
+ "@types/react": "~18.3.9",
92
92
  "@types/react-dom": "~18.3.0",
93
93
  "@types/swagger-ui-dist": "~3.30.5",
94
94
  "@typespec/bundler": "~0.1.7 || >=0.2.0-dev <0.2.0",
@@ -98,9 +98,9 @@
98
98
  "es-module-shims": "~1.10.0",
99
99
  "rimraf": "~6.0.1",
100
100
  "typescript": "~5.6.2",
101
- "vite": "^5.4.4",
101
+ "vite": "^5.4.8",
102
102
  "vite-plugin-checker": "^0.8.0",
103
- "vite-plugin-dts": "4.2.1",
103
+ "vite-plugin-dts": "4.2.2",
104
104
  "@typespec/react-components": "~0.57.0"
105
105
  },
106
106
  "peerDependencies": {},