UNPKG

768 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.getPrefix = exports.getId = exports.source = exports.counter = exports.createSource = void 0;
4var React = require("react");
5var uid_1 = require("./uid");
6var 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};
14exports.createSource = createSource;
15exports.counter = (0, exports.createSource)();
16exports.source = React.createContext((0, exports.createSource)());
17var getId = function (source) { return source.value++; };
18exports.getId = getId;
19var getPrefix = function (source) { return (source ? source.prefix : ''); };
20exports.getPrefix = getPrefix;