@stimulus/core
Advanced tools
Comparing version 0.6.0 to 0.7.0
@@ -6,3 +6,2 @@ export { Action } from "./src/action"; | ||
export { Controller } from "./src/controller"; | ||
export { on } from "./src/decorators"; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wYWNrYWdlcy9Ac3RpbXVsdXMvY29yZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sY0FBYyxDQUFBO0FBQ3JDLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFBO0FBQzFELE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQTtBQUMvQyxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sZUFBZSxDQUFBO0FBQ3ZDLE9BQU8sRUFBRSxVQUFVLEVBQXlCLE1BQU0sa0JBQWtCLENBQUE7QUFDcEUsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGtCQUFrQixDQUFBIn0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wYWNrYWdlcy9Ac3RpbXVsdXMvY29yZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sY0FBYyxDQUFBO0FBQ3JDLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFBO0FBQzFELE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQTtBQUMvQyxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sZUFBZSxDQUFBO0FBQ3ZDLE9BQU8sRUFBRSxVQUFVLEVBQXlCLE1BQU0sa0JBQWtCLENBQUEifQ== |
@@ -11,3 +11,3 @@ // capture nos.: 12 23 4 43 1 5 5 6 6 | ||
ActionDescriptor.forOptions = function (options) { | ||
return new ActionDescriptor(options.identifier || error("Missing identifier in action descriptor"), options.eventName || error("Missing event name in action descriptor"), options.methodName || error("Missing method name in action descriptor"), options.eventTarget); | ||
return new ActionDescriptor(options.identifier || error("Missing identifier in action descriptor"), options.eventName || error("Missing event name in action descriptor"), options.methodName || error("Missing method name in action descriptor"), options.eventTarget || error("Missing event target in action descriptor")); | ||
}; | ||
@@ -18,2 +18,3 @@ ActionDescriptor.forElementWithInlineDescriptorString = function (element, descriptorString) { | ||
options.eventName = options.eventName || this.getDefaultEventNameForElement(element); | ||
options.eventTarget = options.eventTarget || element; | ||
return ActionDescriptor.forOptions(options); | ||
@@ -53,3 +54,3 @@ } | ||
ActionDescriptor.prototype.toString = function () { | ||
var eventNameSuffix = this.eventTarget ? "@" + this.eventTargetName : ""; | ||
var eventNameSuffix = this.eventTargetName ? "@" + this.eventTargetName : ""; | ||
return "" + this.eventName + eventNameSuffix + "->" + this.identifier + "#" + this.methodName; | ||
@@ -87,2 +88,2 @@ }; | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWN0aW9uX2Rlc2NyaXB0b3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9Ac3RpbXVsdXMvY29yZS9zcmMvYWN0aW9uX2Rlc2NyaXB0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBT0EsMkRBQTJEO0FBQzNELElBQU0sT0FBTyxHQUFHLDZDQUE2QyxDQUFBO0FBRTdEO0lBaURFLDBCQUFZLFVBQWtCLEVBQUUsU0FBaUIsRUFBRSxVQUFrQixFQUF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BQzVCLE1BQU0sSUFBSSxLQUFLLENBQUMsT0FBTyxDQUFDLENBQUE7QUFDMUIsQ0FBQztBQUVELDBCQUEwQixlQUF1QjtJQUMvQyxFQUFFLENBQUMsQ0FBQyxlQUFlLElBQUksUUFBUSxDQUFDLENBQUMsQ0FBQztRQUNoQyxNQUFNLENBQUMsTUFBTSxDQUFBO0lBQ2YsQ0FBQztJQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsQ0FBQyxlQUFlLElBQUksVUFBVSxDQUFDLENBQUMsQ0FBQztRQUN6QyxNQUFNLENBQUMsUUFBUSxDQUFBO0lBQ2pCLENBQUM7QUFDSCxDQUFDO0FBRUQsOEJBQThCLFdBQXlCO0lBQ3JELEVBQUUsQ0FBQyxDQUFDLFdBQVcsSUFBSSxNQUFNLENBQUMsQ0FBQyxDQUFDO1FBQzFCLE1BQU0sQ0FBQyxRQUFRLENBQUE7SUFDakIsQ0FBQztJQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsQ0FBQyxXQUFXLElBQUksUUFBUSxDQUFDLENBQUMsQ0FBQztRQUNuQyxNQUFNLENBQUMsVUFBVSxDQUFBO0lBQ25CLENBQUM7QUFDSCxDQUFDIn0= |
@@ -1,24 +0,36 @@ | ||
import { Multimap } from "@stimulus/multimap"; | ||
var ActionSet = /** @class */ (function () { | ||
function ActionSet() { | ||
this.actionsByEventName = new Multimap(); | ||
function ActionSet(context) { | ||
this.context = context; | ||
this.started = false; | ||
this.actions = new Set; | ||
} | ||
Object.defineProperty(ActionSet.prototype, "actions", { | ||
get: function () { | ||
return this.actionsByEventName.values; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
ActionSet.prototype.start = function () { | ||
if (!this.started) { | ||
this.started = true; | ||
this.connectActions(); | ||
} | ||
}; | ||
ActionSet.prototype.stop = function () { | ||
if (this.started) { | ||
this.disconnectActions(); | ||
this.started = false; | ||
} | ||
}; | ||
ActionSet.prototype.add = function (action) { | ||
this.actionsByEventName.add(action.eventName, action); | ||
if (!this.actions.has(action)) { | ||
action.connect(); | ||
this.actions.add(action); | ||
} | ||
}; | ||
ActionSet.prototype.delete = function (action) { | ||
this.actionsByEventName.delete(action.eventName, action); | ||
if (this.actions.has(action)) { | ||
this.actions.delete(action); | ||
action.disconnect(); | ||
} | ||
}; | ||
ActionSet.prototype.has = function (action) { | ||
return this.actionsByEventName.hasValue(action); | ||
ActionSet.prototype.connectActions = function () { | ||
this.actions.forEach(function (action) { return action.connect(); }); | ||
}; | ||
ActionSet.prototype.getActionsForEventName = function (eventName) { | ||
return this.actionsByEventName.getValuesForKey(eventName); | ||
ActionSet.prototype.disconnectActions = function () { | ||
this.actions.forEach(function (action) { return action.disconnect(); }); | ||
}; | ||
@@ -28,2 +40,2 @@ return ActionSet; | ||
export { ActionSet }; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWN0aW9uX3NldC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL0BzdGltdWx1cy9jb3JlL3NyYy9hY3Rpb25fc2V0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQTtBQUU3QztJQUdFO1FBQ0UsSUFBSSxDQUFDLGtCQUFrQixHQUFHLElBQUksUUFBUSxFQUFrQixDQUFBO0lBQzFELENBQUM7SUFFRCxzQkFBSSw4QkFBTzthQUFYO1lBQ0UsTUFBTSxDQUFDLElBQUksQ0FBQyxrQkFBa0IsQ0FBQyxNQUFNLENBQUE7UUFDdkMsQ0FBQzs7O09BQUE7SUFFRCx1QkFBRyxHQUFILFVBQUksTUFBYztRQUNoQixJQUFJLENBQUMsa0JBQWtCLENBQUMsR0FBRyxDQUFDLE1BQU0sQ0FBQyxTQUFTLEVBQUUsTUFBTSxDQUFDLENBQUE7SUFDdkQsQ0FB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0FBQyxPQUFPLENBQUMsVUFBQSxNQUFNLElBQUksT0FBQSxNQUFNLENBQUMsVUFBVSxFQUFFLEVBQW5CLENBQW1CLENBQUMsQ0FBQTtJQUNyRCxDQUFDO0lBQ0gsZ0JBQUM7QUFBRCxDQUFDLEFBOUNELElBOENDIn0= |
var Action = /** @class */ (function () { | ||
function Action(context, descriptor, eventTarget, delegatedTargetMatcher) { | ||
function Action(context, descriptor, eventTarget) { | ||
this.context = context; | ||
this.descriptor = descriptor; | ||
this.eventTarget = eventTarget; | ||
this.delegatedTargetMatcher = delegatedTargetMatcher; | ||
} | ||
Object.defineProperty(Action.prototype, "controller", { | ||
Action.prototype.connect = function () { | ||
this.eventTarget.addEventListener(this.eventName, this, false); | ||
}; | ||
Action.prototype.disconnect = function () { | ||
this.eventTarget.removeEventListener(this.eventName, this, false); | ||
}; | ||
Action.prototype.hasSameDescriptorAs = function (action) { | ||
return action != null && action.descriptor.isEqualTo(this.descriptor); | ||
}; | ||
Action.prototype.handleEvent = function (event) { | ||
if (this.willBeInvokedByEvent(event)) { | ||
this.invokeWithEvent(event); | ||
} | ||
}; | ||
Action.prototype.invokeWithEvent = function (event) { | ||
try { | ||
this.method.call(this.controller, event, event.currentTarget); | ||
} | ||
catch (error) { | ||
this.context.reportError(error, "invoking action \"" + this.descriptor + "\"", event, this); | ||
} | ||
}; | ||
Object.defineProperty(Action.prototype, "eventName", { | ||
get: function () { | ||
return this.context.controller; | ||
return this.descriptor.eventName; | ||
}, | ||
@@ -15,5 +36,9 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(Action.prototype, "eventName", { | ||
Object.defineProperty(Action.prototype, "method", { | ||
get: function () { | ||
return this.descriptor.eventName; | ||
var method = this.controller[this.methodName]; | ||
if (typeof method == "function") { | ||
return method; | ||
} | ||
throw new Error("Action \"" + this.descriptor + "\" references undefined method \"" + this.methodName + "\""); | ||
}, | ||
@@ -23,5 +48,17 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(Action.prototype, "methodName", { | ||
Action.prototype.willBeInvokedByEvent = function (event) { | ||
var eventTarget = event.target; | ||
if (this.element === eventTarget) { | ||
return true; | ||
} | ||
else if (eventTarget instanceof Element && this.element.contains(eventTarget)) { | ||
return this.scope.containsElement(eventTarget); | ||
} | ||
else { | ||
return true; | ||
} | ||
}; | ||
Object.defineProperty(Action.prototype, "controller", { | ||
get: function () { | ||
return this.descriptor.methodName; | ||
return this.context.controller; | ||
}, | ||
@@ -31,5 +68,5 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(Action.prototype, "isDirect", { | ||
Object.defineProperty(Action.prototype, "methodName", { | ||
get: function () { | ||
return !this.isDelegated; | ||
return this.descriptor.methodName; | ||
}, | ||
@@ -39,5 +76,5 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(Action.prototype, "isDelegated", { | ||
Object.defineProperty(Action.prototype, "element", { | ||
get: function () { | ||
return typeof this.delegatedTargetMatcher == "function"; | ||
return this.scope.element; | ||
}, | ||
@@ -47,9 +84,5 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(Action.prototype, "method", { | ||
Object.defineProperty(Action.prototype, "scope", { | ||
get: function () { | ||
var method = this.controller[this.methodName]; | ||
if (typeof method == "function") { | ||
return method; | ||
} | ||
throw new Error("Action \"" + this.descriptor + "\" references undefined method \"" + this.methodName + "\""); | ||
return this.context.scope; | ||
}, | ||
@@ -59,20 +92,5 @@ enumerable: true, | ||
}); | ||
Action.prototype.hasSameDescriptorAs = function (action) { | ||
return action != null && action.descriptor.isEqualTo(this.descriptor); | ||
}; | ||
Action.prototype.matchDelegatedTarget = function (eventTarget) { | ||
var matcher = this.delegatedTargetMatcher; | ||
return matcher ? matcher(eventTarget) : false; | ||
}; | ||
Action.prototype.invokeWithEventAndTarget = function (event, eventTarget) { | ||
try { | ||
this.method.call(this.controller, event, eventTarget); | ||
} | ||
catch (error) { | ||
this.context.reportError(error, "invoking action \"" + this.descriptor + "\"", event, this); | ||
} | ||
}; | ||
return Action; | ||
}()); | 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FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLEtBQUssQ0FBQTtRQUMzQixDQUFDOzs7T0FBQTtJQUNILGFBQUM7QUFBRCxDQUFDLEFBM0VELElBMkVDIn0= |
import { Action } from "./action"; | ||
import { ActionDescriptor } from "./action_descriptor"; | ||
import { Dispatcher } from "./dispatcher"; | ||
import { ActionSet } from "./action_set"; | ||
import { InlineActionObserver } from "./inline_action_observer"; | ||
@@ -10,3 +10,3 @@ import { Scope } from "./scope"; | ||
this.scope = new Scope(this.configuration, this.identifier, element); | ||
this.dispatcher = new Dispatcher(this); | ||
this.actions = new ActionSet(this); | ||
this.inlineActionObserver = new InlineActionObserver(this, this); | ||
@@ -22,3 +22,3 @@ try { | ||
Context.prototype.connect = function () { | ||
this.dispatcher.start(); | ||
this.actions.start(); | ||
this.inlineActionObserver.start(); | ||
@@ -40,3 +40,3 @@ try { | ||
this.inlineActionObserver.stop(); | ||
this.dispatcher.stop(); | ||
this.actions.stop(); | ||
}; | ||
@@ -92,7 +92,7 @@ Object.defineProperty(Context.prototype, "application", { | ||
if (action) { | ||
this.dispatcher.addAction(action); | ||
this.actions.add(action); | ||
} | ||
}; | ||
Context.prototype.removeAction = function (action) { | ||
this.dispatcher.removeAction(action); | ||
this.actions.delete(action); | ||
}; | ||
@@ -130,2 +130,2 @@ // Inline action observer delegate | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udGV4dC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL0BzdGltdWx1cy9jb3JlL3NyYy9jb250ZXh0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxVQUFVLENBQUE7QUFDakMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0scUJBQXFCLENBQUE7QUFLdEQsT0FBTyxF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ElBQUksQ0FBQyxHQUFHLENBQUMsVUFBQSxHQUFHLElBQUksT0FBQSxJQUFJLEVBQUosQ0FBSSxDQUFDLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFBO1FBQ25ELElBQU0sTUFBTSxHQUFHLHVCQUFxQixVQUFVLGFBQVUsQ0FBQTtRQUN4RCxNQUFNLENBQUMsT0FBTyxDQUFDLEtBQUssT0FBYixPQUFPLEdBQU8sTUFBTSxFQUFFLE9BQU8sRUFBRSxLQUFLLFNBQUssSUFBSSxHQUFFLElBQUksQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLE9BQU8sSUFBQztJQUN0RixDQUFDO0lBQ0gsY0FBQztBQUFELENBQUMsQUE1R0QsSUE0R0M7O0FBRUQsdUJBQXVCLE1BQVc7SUFDaEMsRUFBRSxDQUFDLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDO1FBQ1osTUFBTSxDQUFDLEtBQUssQ0FBQTtJQUNkLENBQUM7SUFBQyxJQUFJLENBQUMsRUFBRSxDQUFDLENBQUMsT0FBTyxXQUFXLElBQUksV0FBVyxDQUFDLENBQUMsQ0FBQztRQUM3QyxNQUFNLENBQUMsTUFBTSxZQUFZLFdBQVcsQ0FBQTtJQUN0QyxDQUFDO0lBQUMsSUFBSSxDQUFDLENBQUM7UUFDTixNQUFNLENBQUMsT0FBTyxNQUFNLENBQUMsZ0JBQWdCLElBQUksVUFBVSxDQUFBO0lBQ3JELENBQUM7QUFDSCxDQUFDIn0= |
@@ -73,3 +73,4 @@ import { Action } from "./action"; | ||
if (newAction) { | ||
return this.connectedActions.getValuesForKey(element).find(function (action) { return action.hasSameDescriptorAs(newAction); }); | ||
var actions = this.connectedActions.getValuesForKey(element); | ||
return actions.find(function (action) { return action.hasSameDescriptorAs(newAction); }); | ||
} | ||
@@ -81,8 +82,3 @@ }; | ||
if (descriptor.identifier == this.identifier) { | ||
if (descriptor.eventTarget) { | ||
return new Action(this.context, descriptor, descriptor.eventTarget); | ||
} | ||
else { | ||
return new Action(this.context, descriptor, this.element, function (eventTarget) { return eventTarget == element; }); | ||
} | ||
return new Action(this.context, descriptor, descriptor.eventTarget); | ||
} | ||
@@ -97,2 +93,2 @@ } | ||
export { InlineActionObserver }; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5saW5lX2FjdGlvbl9vYnNlcnZlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL0BzdGltdWx1cy9jb3JlL3NyYy9pbmxpbmVfYWN0aW9uX29ic2VydmVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxVQUFVLENBQUE7QUFDakMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0scUJBQXFCLENBQUE7QUFHdEQsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLG9CQUFvQixDQUFBO0FBRTdDLE9BQU8sRUFBRSxpQkFBaUIsRUFBNkIsTUFBTSw4QkFBOEIsQ0FBQTtBQU8zRjtJQU1FLDhCQUFZLE9BQWdCLEVBQUUsUUFBc0M7UUFDbEUsSUFBSSxDQUFDLE9BQU8sR0FBRyxPQUFPLENBQUE7UUFDdEIsSUFBSSxDQUFDLFFBQVEsR0FBRyxRQUFRLENBQUE7UUFDeEIsSUFBSSxDQUFDLGlCQUFpQixHQUFHLElBQUksaUJBQWlCLENBQUMsSUFBSSxDQUFDLE9BQU8sRUFBRSxJQUFJLENBQUMsYUFBYSxFQUFFLElBQUksQ0FBQyxDQUFBO1FBQ3RGLElBQUksQ0FBQyxnQkFBZ0IsR0FBRyxJQUFJLFFBQVEsRUFBbUIsQ0FBQTtJQUN6RCxDQUFDO0lBRUQsc0JBQUksdUNBQUs7YUFBVDtZQUNFLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBT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QUMsQ0FBQyxDQUFDO2dCQUM3QyxNQUFNLENBQUMsSUFBSSxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sRUFBRSxVQUFVLEVBQUUsVUFBVSxDQUFDLFdBQVcsQ0FBQyxDQUFBO1lBQ3JFLENBQUM7UUFDSCxDQUFDO1FBQUMsS0FBSyxDQUFDLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQztZQUNmLElBQUksQ0FBQyxPQUFPLENBQUMsV0FBVyxDQUFDLEtBQUssRUFBRSxpQ0FBOEIsZ0JBQWdCLG1CQUFlLEVBQUUsT0FBTyxDQUFDLENBQUE7UUFDekcsQ0FBQztJQUNILENBQUM7SUFDSCwyQkFBQztBQUFELENBQUMsQUEvRUQsSUErRUMifQ== |
export function attributeValueContainsToken(attributeName, token) { | ||
return "[" + CSS.escape(attributeName) + "~=\"" + CSS.escape(token) + "\"]"; | ||
return "[" + attributeName + "~=\"" + token + "\"]"; | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VsZWN0b3JzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvQHN0aW11bHVzL2NvcmUvc3JjL3NlbGVjdG9ycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFJQSxNQUFNLHNDQUFzQyxhQUFxQixFQUFFLEtBQWE7SUFDOUUsTUFBTSxDQUFDLE1BQUksR0FBRyxDQUFDLE1BQU0sQ0FBQyxhQUFhLENBQUMsWUFBTSxHQUFHLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxRQUFJLENBQUE7QUFDakUsQ0FBQyJ9 | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VsZWN0b3JzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvQHN0aW11bHVzL2NvcmUvc3JjL3NlbGVjdG9ycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLHNDQUFzQyxhQUFxQixFQUFFLEtBQWE7SUFDOUUsTUFBTSxDQUFDLE1BQUksYUFBYSxZQUFNLEtBQUssUUFBSSxDQUFBO0FBQ3pDLENBQUMifQ== |
@@ -6,2 +6,1 @@ export { Action } from "./src/action"; | ||
export { Controller, ControllerConstructor } from "./src/controller"; | ||
export { on } from "./src/decorators"; |
@@ -12,3 +12,3 @@ export interface ActionDescriptorOptions { | ||
methodName: string; | ||
eventTarget?: EventTarget; | ||
eventTarget: EventTarget; | ||
static forOptions(options: ActionDescriptorOptions): ActionDescriptor; | ||
@@ -18,3 +18,3 @@ static forElementWithInlineDescriptorString(element: Element, descriptorString: string): ActionDescriptor; | ||
private static getDefaultEventNameForElement(element); | ||
constructor(identifier: string, eventName: string, methodName: string, eventTarget?: EventTarget); | ||
constructor(identifier: string, eventName: string, methodName: string, eventTarget: EventTarget); | ||
readonly eventTargetName: string | undefined; | ||
@@ -21,0 +21,0 @@ isEqualTo(descriptor: ActionDescriptor | null): boolean; |
import { Action } from "./action"; | ||
import { Context } from "./context"; | ||
export declare class ActionSet { | ||
private actionsByEventName; | ||
constructor(); | ||
readonly actions: Action[]; | ||
context: Context; | ||
started: boolean; | ||
actions: Set<Action>; | ||
constructor(context: Context); | ||
start(): void; | ||
stop(): void; | ||
add(action: Action): void; | ||
delete(action: Action): void; | ||
has(action: Action): boolean; | ||
getActionsForEventName(eventName: string): Action[]; | ||
private connectActions(); | ||
private disconnectActions(); | ||
} |
import { ActionDescriptor } from "./action_descriptor"; | ||
import { Context } from "./context"; | ||
import { Controller } from "./controller"; | ||
export declare type EventTargetMatcher = (eventTarget: EventTarget) => boolean; | ||
export declare class Action { | ||
import { Scope } from "./scope"; | ||
export declare class Action implements EventListenerObject { | ||
context: Context; | ||
descriptor: ActionDescriptor; | ||
eventTarget: EventTarget; | ||
delegatedTargetMatcher?: EventTargetMatcher; | ||
constructor(context: Context, descriptor: ActionDescriptor, eventTarget: EventTarget, delegatedTargetMatcher?: EventTargetMatcher); | ||
constructor(context: Context, descriptor: ActionDescriptor, eventTarget: EventTarget); | ||
connect(): void; | ||
disconnect(): void; | ||
hasSameDescriptorAs(action: Action | null): boolean; | ||
handleEvent(event: Event): void; | ||
invokeWithEvent(event: Event): void; | ||
readonly eventName: string; | ||
readonly method: Function; | ||
willBeInvokedByEvent(event: Event): boolean; | ||
readonly controller: Controller; | ||
readonly eventName: string; | ||
readonly methodName: string; | ||
readonly isDirect: boolean; | ||
readonly isDelegated: boolean; | ||
readonly method: Function; | ||
hasSameDescriptorAs(action: Action | null): boolean; | ||
matchDelegatedTarget(eventTarget: EventTarget): boolean; | ||
invokeWithEventAndTarget(event: Event, eventTarget: EventTarget): void; | ||
readonly element: Element; | ||
readonly scope: Scope; | ||
} |
@@ -12,3 +12,3 @@ import { Action } from "./action"; | ||
controller: Controller; | ||
private dispatcher; | ||
private actions; | ||
private inlineActionObserver; | ||
@@ -15,0 +15,0 @@ constructor(contextSet: ContextSet, element: Element); |
{ | ||
"name": "@stimulus/core", | ||
"version": "0.6.0", | ||
"description": "👉✨", | ||
"version": "0.7.0", | ||
"description": "Stimulus JavaScript framework: Core library", | ||
"author": "Basecamp, LLC", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
75849
31
1090