Skip to content

Commit 8cfcd44

Browse files
committed
Fix exports
1 parent e6a1df5 commit 8cfcd44

File tree

4 files changed

+106
-3
lines changed

4 files changed

+106
-3
lines changed

dist/BlinkformsClient.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { NodeSchema, SchemaParserConfigOpt, RootNode, NodeState, FormContext, No
22
export declare type BlinkformsStateTransformer = (state: NodeState<any>, root: NodeAny) => NodeState<any>;
33
export declare type BlinkformsContextUpdateHandler = (context: FormContext, source: NodeAny) => void;
44
export declare type BlinkformsContextTransformer = (fn: (context: FormContext) => FormContext, source: NodeAny) => void;
5-
export default class BlinkformsClient {
5+
export declare class BlinkformsClient {
66
tree: RootNode;
77
state: NodeState<any>;
88
stateTransformers: Array<BlinkformsStateTransformer>;

dist/index.es.js

+52-1
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,57 @@ function transformSchemaIntoTree(node, rootNode, config) {
506506
return rootNode;
507507
}
508508

509+
var BlinkformsClient = /** @class */ (function () {
510+
function BlinkformsClient() {
511+
this.tree = null;
512+
this.state = null;
513+
this.stateTransformers = [];
514+
this.contextUpdateHandlers = [];
515+
this.contextTransformers = [];
516+
this.rootConfig = {};
517+
}
518+
BlinkformsClient.prototype.configure = function (conf) {
519+
this.rootConfig = (__assign({}, this.rootConfig, conf));
520+
};
521+
BlinkformsClient.prototype.registerHandlers = function (handlers) {
522+
var newHandlers = __assign({}, this.rootConfig.handlers);
523+
Object.keys(handlers).forEach(function (key) {
524+
newHandlers[key] = __assign({}, newHandlers[key], handlers[key]);
525+
});
526+
this.rootConfig = (__assign({}, this.rootConfig, { handlers: __assign({}, this.rootConfig.handlers, newHandlers) }));
527+
};
528+
BlinkformsClient.prototype.handleFormStateUpdate = function (state, root) {
529+
var _this = this;
530+
this.state = state;
531+
this.stateTransformers.forEach(function (t) {
532+
_this.state = t(_this.state, root);
533+
});
534+
};
535+
BlinkformsClient.prototype.handleFormContextUpdate = function (context, source) {
536+
this.contextUpdateHandlers.forEach(function (t) {
537+
t(context, source);
538+
});
539+
};
540+
BlinkformsClient.prototype.handleFormContextMapping = function (fn, source) {
541+
this.contextTransformers.forEach(function (t) {
542+
t(fn, source);
543+
});
544+
};
545+
BlinkformsClient.prototype.render = function (schema, options) {
546+
var _this = this;
547+
if (options === void 0) { options = null; }
548+
this.tree = transformSchemaIntoTree(schema, null, __assign({ rootSetState: function (state, root) { return _this.handleFormStateUpdate(state, root); }, rootSetContext: function (context, source) { return _this.handleFormContextUpdate(context, source); }, rootModifyContext: function (fn, source) { return _this.handleFormContextMapping(fn, source); }, rootState: {} }, this.rootConfig, options));
549+
return this;
550+
};
551+
BlinkformsClient.prototype.getTree = function () {
552+
return this.tree;
553+
};
554+
BlinkformsClient.prototype.getState = function () {
555+
return this.state;
556+
};
557+
return BlinkformsClient;
558+
}());
559+
509560
var CompositeNode = /** @class */ (function (_super) {
510561
__extends(CompositeNode, _super);
511562
function CompositeNode() {
@@ -593,4 +644,4 @@ var SimpleNode = /** @class */ (function (_super) {
593644
return SimpleNode;
594645
}(Node));
595646

596-
export { CompositeNode, SimpleNode, defaultParserConfig, recTransformSchemaIntoTree, isNodeMetaOutputValue, getMetaOutputSourceNodeByPath, transformOutputToRawData, validateRoot, transformSchemaIntoTree, NodeType, Node, RootNode, isNodeErrorPure };
647+
export { BlinkformsClient, CompositeNode, SimpleNode, defaultParserConfig, recTransformSchemaIntoTree, isNodeMetaOutputValue, getMetaOutputSourceNodeByPath, transformOutputToRawData, validateRoot, transformSchemaIntoTree, NodeType, Node, RootNode, isNodeErrorPure };

dist/index.js

+52
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,57 @@ function transformSchemaIntoTree(node, rootNode, config) {
511511
return rootNode;
512512
}
513513

514+
var BlinkformsClient = /** @class */ (function () {
515+
function BlinkformsClient() {
516+
this.tree = null;
517+
this.state = null;
518+
this.stateTransformers = [];
519+
this.contextUpdateHandlers = [];
520+
this.contextTransformers = [];
521+
this.rootConfig = {};
522+
}
523+
BlinkformsClient.prototype.configure = function (conf) {
524+
this.rootConfig = (__assign({}, this.rootConfig, conf));
525+
};
526+
BlinkformsClient.prototype.registerHandlers = function (handlers) {
527+
var newHandlers = __assign({}, this.rootConfig.handlers);
528+
Object.keys(handlers).forEach(function (key) {
529+
newHandlers[key] = __assign({}, newHandlers[key], handlers[key]);
530+
});
531+
this.rootConfig = (__assign({}, this.rootConfig, { handlers: __assign({}, this.rootConfig.handlers, newHandlers) }));
532+
};
533+
BlinkformsClient.prototype.handleFormStateUpdate = function (state, root) {
534+
var _this = this;
535+
this.state = state;
536+
this.stateTransformers.forEach(function (t) {
537+
_this.state = t(_this.state, root);
538+
});
539+
};
540+
BlinkformsClient.prototype.handleFormContextUpdate = function (context, source) {
541+
this.contextUpdateHandlers.forEach(function (t) {
542+
t(context, source);
543+
});
544+
};
545+
BlinkformsClient.prototype.handleFormContextMapping = function (fn, source) {
546+
this.contextTransformers.forEach(function (t) {
547+
t(fn, source);
548+
});
549+
};
550+
BlinkformsClient.prototype.render = function (schema, options) {
551+
var _this = this;
552+
if (options === void 0) { options = null; }
553+
this.tree = transformSchemaIntoTree(schema, null, __assign({ rootSetState: function (state, root) { return _this.handleFormStateUpdate(state, root); }, rootSetContext: function (context, source) { return _this.handleFormContextUpdate(context, source); }, rootModifyContext: function (fn, source) { return _this.handleFormContextMapping(fn, source); }, rootState: {} }, this.rootConfig, options));
554+
return this;
555+
};
556+
BlinkformsClient.prototype.getTree = function () {
557+
return this.tree;
558+
};
559+
BlinkformsClient.prototype.getState = function () {
560+
return this.state;
561+
};
562+
return BlinkformsClient;
563+
}());
564+
514565
var CompositeNode = /** @class */ (function (_super) {
515566
__extends(CompositeNode, _super);
516567
function CompositeNode() {
@@ -598,6 +649,7 @@ var SimpleNode = /** @class */ (function (_super) {
598649
return SimpleNode;
599650
}(Node));
600651

652+
exports.BlinkformsClient = BlinkformsClient;
601653
exports.CompositeNode = CompositeNode;
602654
exports.SimpleNode = SimpleNode;
603655
exports.defaultParserConfig = defaultParserConfig;

src/BlinkformsClient.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export type BlinkformsStateTransformer = (state: NodeState<any>, root: NodeAny)
1313
export type BlinkformsContextUpdateHandler = (context: FormContext, source: NodeAny) => void;
1414
export type BlinkformsContextTransformer = (fn: (context: FormContext) => FormContext, source: NodeAny) => void;
1515

16-
export default class BlinkformsClient {
16+
export class BlinkformsClient {
1717

1818
tree: RootNode;
1919
state: NodeState<any>;

0 commit comments

Comments
 (0)