1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.getPrefix = exports.getId = exports.source = exports.counter = exports.createSource = void 0;
|
4 | var React = require("react");
|
5 | var uid_1 = require("./uid");
|
6 | var createSource = function (prefix) {
|
7 | if (prefix === void 0) { prefix = ''; }
|
8 | return ({
|
9 | value: 1,
|
10 | prefix: prefix,
|
11 | uid: (0, uid_1.generateUID)(),
|
12 | });
|
13 | };
|
14 | exports.createSource = createSource;
|
15 | exports.counter = (0, exports.createSource)();
|
16 | exports.source = React.createContext((0, exports.createSource)());
|
17 | var getId = function (source) { return source.value++; };
|
18 | exports.getId = getId;
|
19 | var getPrefix = function (source) { return (source ? source.prefix : ''); };
|
20 | exports.getPrefix = getPrefix;
|