first commit

This commit is contained in:
Stefan Hacker
2026-04-03 09:38:48 +02:00
commit 37ad745546
47450 changed files with 3120798 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getId = getId;
exports.resetIds = resetIds;
var getWindow_1 = require("./dom/getWindow");
var merge_styles_1 = require("@fluentui/merge-styles");
// Initialize global window id.
var CURRENT_ID_PROPERTY = '__currentId__';
var DEFAULT_ID_STRING = 'id__';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
var _global = (0, getWindow_1.getWindow)() || {};
if (_global[CURRENT_ID_PROPERTY] === undefined) {
_global[CURRENT_ID_PROPERTY] = 0;
}
var _initializedStylesheetResets = false;
/**
* Generates a unique id in the global scope (this spans across duplicate copies of the same library.)
*
* @public
*/
function getId(prefix) {
if (!_initializedStylesheetResets) {
// Configure ids to reset on stylesheet resets.
var stylesheet = merge_styles_1.Stylesheet.getInstance();
if (stylesheet && stylesheet.onReset) {
stylesheet.onReset(resetIds);
}
_initializedStylesheetResets = true;
}
var index = _global[CURRENT_ID_PROPERTY]++;
return (prefix === undefined ? DEFAULT_ID_STRING : prefix) + index;
}
/**
* Resets id counter to an (optional) number.
*
* @public
*/
function resetIds(counter) {
if (counter === void 0) { counter = 0; }
_global[CURRENT_ID_PROPERTY] = counter;
}
//# sourceMappingURL=getId.js.map