sproutjs-core 2.9.1 → 2.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sproutjs-core",
3
- "version": "2.9.1",
3
+ "version": "2.9.2",
4
4
  "keywords": [],
5
5
  "author": "",
6
6
  "license": "ISC",
package/sprout-core.js CHANGED
@@ -60,8 +60,8 @@ var AUTO_ATTRIBUTES_TO_PROPS = new ReadonlySet(['checked', 'disabled', 'selected
60
60
  var SUPPORTED_ATTRIBUTES_FOR_BINDING = new ReadonlySet(['value', 'checked']);
61
61
 
62
62
  // These are "built-in" state props that are automatically added to state objects,
63
- // and should not be included in the normal state change/check flow
64
- var BUILT_IN_STATE_PROPS = new ReadonlySet(['_global', '_gettingDependenciesFor', '_localStateManager', '_stateManager', '_binding', '_populate', '_isActive', '_isStateManager', '_isStatefulArray', 'hasOwnProperty']);
63
+ // and should not be treated as user state props.
64
+ var BUILT_IN_STATE_PROPS = new ReadonlySet(['$host', '_global', '_stateManager', '_isActive', '_isStateManager', 'populate', 'hasOwnProperty']);
65
65
  var GLOBAL_STATE_VAR_NAME = "SproutGlobalState";
66
66
  var GLOBAL_STATE_FUNCTION_NAME = "getGlobalState";
67
67
  var GLOBAL_STATE_NOT_SET_YET = "Global State Not Set Yet";
@@ -333,6 +333,9 @@ var FRAME_BUDGET = 8;
333
333
 
334
334
  // CSS to always put on each Shadow DOM root
335
335
  var SHADOW_ROOT_CSS = ':host { contain: layout paint; }';
336
+
337
+ // Maybe allow completely scoped app in the fure
338
+ var SproutCustomElementRegistry = new CustomElementRegistry();
336
339
  ;// ./src/core/attr_utils.js
337
340
 
338
341
 
@@ -709,13 +712,14 @@ var COMMANDS = {
709
712
  this.bindAttributeToState(attributeName, statePropName);
710
713
  },
711
714
  bindprop: function bindprop(commandValue) {
715
+ var _this = this;
712
716
  var _commandValue$split5 = commandValue.split(':'),
713
717
  _commandValue$split6 = _slicedToArray(_commandValue$split5, 2),
714
718
  statePropName = _commandValue$split6[0],
715
719
  elementPropName = _commandValue$split6[1];
716
720
  var _this$getState = this.getState(statePropName, true),
717
721
  _this$getState2 = _slicedToArray(_this$getState, 2),
718
- _ = _this$getState2[0],
722
+ stateValue = _this$getState2[0],
719
723
  stateObject = _this$getState2[1];
720
724
  if (true) {
721
725
  if (!stateObject) {
@@ -723,10 +727,20 @@ var COMMANDS = {
723
727
  return;
724
728
  }
725
729
  }
726
- this[elementPropName] = stateObject[statePropName];
730
+ this[elementPropName] = stateValue;
731
+ var stateManager = stateObject._stateManager;
732
+ stateManager.addStateHook(function (_, newValue) {
733
+ _this[elementPropName] = newValue;
734
+ }, [statePropName]);
727
735
  }
728
736
  };
729
737
  ;// ./src/shared/parse_utils.js
738
+ function parse_utils_toConsumableArray(r) { return parse_utils_arrayWithoutHoles(r) || parse_utils_iterableToArray(r) || parse_utils_unsupportedIterableToArray(r) || parse_utils_nonIterableSpread(); }
739
+ function parse_utils_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
740
+ function parse_utils_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return parse_utils_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? parse_utils_arrayLikeToArray(r, a) : void 0; } }
741
+ function parse_utils_iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
742
+ function parse_utils_arrayWithoutHoles(r) { if (Array.isArray(r)) return parse_utils_arrayLikeToArray(r); }
743
+ function parse_utils_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
730
744
  /* Possible expression:
731
745
  * literal: straight state prop,.
732
746
  * negation: !something (not something)
@@ -749,7 +763,7 @@ function parseStateExpression(expression) {
749
763
  return ["equality", expression.substring(3).split(':')];
750
764
  }
751
765
  if (_char === '?') {
752
- return ["ternary", parsed, expression.substring(charIndex + 1).split(':')];
766
+ return ["ternary", [parsed].concat(parse_utils_toConsumableArray(expression.substring(charIndex + 1).split(':')))];
753
767
  }
754
768
  parsed += _char;
755
769
  }
@@ -818,10 +832,6 @@ function extendElementClassWithReactiveElementClass(elementClass) {
818
832
  var _this;
819
833
  ReactiveElement_classCallCheck(this, ReactiveElement);
820
834
  _this = ReactiveElement_callSuper(this, ReactiveElement);
821
- // This is for when using moveBefore for detaching and reattaching DOM
822
- // We considered using it - but it is not widely supported,
823
- // and you have to move it to another DOM for it to work correctly
824
- // connectedMoveCallback() {}
825
835
  _classPrivateMethodInitSpec(_this, _ReactiveElement_brand);
826
836
  // Should contain the parent (containing) custom element (a ReactiveCustomElement instance)
827
837
  _defineProperty(_this, "host", null);
@@ -829,6 +839,7 @@ function extendElementClassWithReactiveElementClass(elementClass) {
829
839
  _classPrivateFieldInitSpec(_this, _wasMounted, false);
830
840
  // The name used for the ref property
831
841
  _defineProperty(_this, "refName", void 0);
842
+ _defineProperty(_this, "boundStateToProperties", new Map());
832
843
  _classPrivateFieldInitSpec(_this, _pendingAttributeChanges, []);
833
844
  _this.isReactiveElement = true;
834
845
  _this.isNativeElement = true;
@@ -836,6 +847,11 @@ function extendElementClassWithReactiveElementClass(elementClass) {
836
847
  }
837
848
  ReactiveElement_inherits(ReactiveElement, _elementClass);
838
849
  return ReactiveElement_createClass(ReactiveElement, [{
850
+ key: "bindStateToProperty",
851
+ value: function bindStateToProperty(statePropName, elementProprtyName) {
852
+ this.boundStateToProperties.set(statePropName, elementProprtyName);
853
+ }
854
+ }, {
839
855
  key: "activate",
840
856
  value: function activate() {
841
857
  var _this2 = this;
@@ -943,6 +959,13 @@ function extendElementClassWithReactiveElementClass(elementClass) {
943
959
  delete host.ref[this.refName];
944
960
  }
945
961
  }
962
+
963
+ // Including this will run this when "moving" the elements
964
+ // in the same document, i.e. instead of calling connectedCallback/disoconnectedCallback
965
+ // It keeps the element "alive"
966
+ }, {
967
+ key: "connectedMoveCallback",
968
+ value: function connectedMoveCallback() {}
946
969
  }, {
947
970
  key: "attributeChangedCallback",
948
971
  value: function attributeChangedCallback(attributeName, oldValue, newValue) {
@@ -1253,6 +1276,7 @@ function extendElementClassWithReactiveElementClass(elementClass) {
1253
1276
  }
1254
1277
  ;// ./src/core/DOM_utils.js
1255
1278
 
1279
+
1256
1280
  function isElementAList(element) {
1257
1281
  return element.tagName === "OL" || element.tagName === "UL";
1258
1282
  }
@@ -1263,6 +1287,11 @@ function getCustomElementFromMappedElement(element) {
1263
1287
  if (isReactiveCustomElement(element)) return element;
1264
1288
  if (isReactiveCustomElement(element.firstElementChild)) return element.firstElementChild;
1265
1289
  }
1290
+ function createSproutElement(elementName) {
1291
+ return document.createElement(elementName, {
1292
+ customElementRegistry: SproutCustomElementRegistry
1293
+ });
1294
+ }
1266
1295
  ;// ./src/shared/paint_utils.js
1267
1296
  function paint_utils_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = paint_utils_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
1268
1297
  function paint_utils_slicedToArray(r, e) { return paint_utils_arrayWithHoles(r) || paint_utils_iterableToArrayLimit(r, e) || paint_utils_unsupportedIterableToArray(r, e) || paint_utils_nonIterableRest(); }
@@ -1934,7 +1963,7 @@ function generateStateNodeActions(stateManager, stateProp, newValue) {
1934
1963
  // The actual array of state objects is in state[stateProp]
1935
1964
  var stateMapElements = stateManager.stateArrayMaps[stateProp];
1936
1965
  var conditionallyRenderingElements = stateManager.nodeManager.conditionallyRenderingElements[stateProp];
1937
-
1966
+ //const elementsWithPropertyBind = stateManager.elementsWithPropertyBind.get(stateProp);
1938
1967
  // Note, since the value change is handled by a custom setter - that setter checks if the set value is the same -
1939
1968
  // if it is - it won't call , and it won't reach here.
1940
1969
  if (stateNodes) {
@@ -2111,12 +2140,10 @@ function setHiddenProperty(obj, propName, propValue) {
2111
2140
  ;// ./src/shared/state_utils.js
2112
2141
  function state_utils_typeof(o) { "@babel/helpers - typeof"; return state_utils_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, state_utils_typeof(o); }
2113
2142
  function state_utils_slicedToArray(r, e) { return state_utils_arrayWithHoles(r) || state_utils_iterableToArrayLimit(r, e) || state_utils_unsupportedIterableToArray(r, e) || state_utils_nonIterableRest(); }
2114
- function state_utils_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
2115
- function _toArray(r) { return state_utils_arrayWithHoles(r) || state_utils_iterableToArray(r) || state_utils_unsupportedIterableToArray(r) || state_utils_nonIterableRest(); }
2116
2143
  function state_utils_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
2117
2144
  function state_utils_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return state_utils_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? state_utils_arrayLikeToArray(r, a) : void 0; } }
2118
2145
  function state_utils_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
2119
- function state_utils_iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
2146
+ function state_utils_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
2120
2147
  function state_utils_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
2121
2148
 
2122
2149
 
@@ -2151,10 +2178,12 @@ var setAttribute = function setAttribute(attrName, attrValue) {
2151
2178
  // This creates the binding to state props on "State attributes".
2152
2179
  // This function is called when a custom element instance ic connected to the DOM
2153
2180
  var setStateAttribute = function setStateAttribute(attrName, statePropExpression) {
2181
+ // In state expressions it is expected for the first "argument"
2182
+ // to always be the stateProp itself
2154
2183
  var _parseStateExpression = parseStateExpression(statePropExpression),
2155
- _parseStateExpression2 = _toArray(_parseStateExpression),
2184
+ _parseStateExpression2 = state_utils_slicedToArray(_parseStateExpression, 2),
2156
2185
  type = _parseStateExpression2[0],
2157
- args = _parseStateExpression2.slice(1);
2186
+ args = _parseStateExpression2[1];
2158
2187
  var stateProp = args[0];
2159
2188
  var _this$getState = this.getState(stateProp, true),
2160
2189
  _this$getState2 = state_utils_slicedToArray(_this$getState, 2),
@@ -2202,9 +2231,9 @@ var setStateAttribute = function setStateAttribute(attrName, statePropExpression
2202
2231
  };
2203
2232
  var setStateText = function setStateText(statePropExpression) {
2204
2233
  var _parseStateExpression3 = parseStateExpression(statePropExpression),
2205
- _parseStateExpression4 = _toArray(_parseStateExpression3),
2234
+ _parseStateExpression4 = state_utils_slicedToArray(_parseStateExpression3, 2),
2206
2235
  type = _parseStateExpression4[0],
2207
- args = _parseStateExpression4.slice(1);
2236
+ args = _parseStateExpression4[1];
2208
2237
  var stateProp = args[0];
2209
2238
  var _this$getState3 = this.getState(stateProp, true),
2210
2239
  _this$getState4 = state_utils_slicedToArray(_this$getState3, 2),
@@ -2278,10 +2307,12 @@ function mapStateArrayToElements(stateItems, elemName, wrapInElement, parentElem
2278
2307
 
2279
2308
  // Main function that handles all state changes in a state object
2280
2309
  function handleStateChange(stateManager, stateProp, changedValue) {
2281
- var _descrp$get;
2310
+ var _descrp$get, _stateManager$stateHo, _stateManager$stateHo2;
2282
2311
  if (isBuiltInStateProp(stateProp)) return;
2283
2312
  console.log("Handling state change for: " + stateProp);
2284
2313
  // At this point, if the value is taken from state, it should be a getter value
2314
+ // We are SURE the value is new and has been changed at this point
2315
+ // (we validate this earlier)
2285
2316
  var newValue = changedValue !== null && changedValue !== void 0 ? changedValue : stateManager.state[stateProp];
2286
2317
  var descrp = Object.getOwnPropertyDescriptor(stateManager.state, stateProp);
2287
2318
  var isGetter = descrp === null || descrp === void 0 || (_descrp$get = descrp.get) === null || _descrp$get === void 0 ? void 0 : _descrp$get.isStateGetter;
@@ -2292,6 +2323,14 @@ function handleStateChange(stateManager, stateProp, changedValue) {
2292
2323
  if (!stateProp.startsWith('!')) {
2293
2324
  generateStateNodeActions(stateManager, "!".concat(stateProp), !newValue, isGetter);
2294
2325
  }
2326
+
2327
+ // Run state hooks
2328
+ (_stateManager$stateHo = stateManager.stateHooks.get(stateProp)) === null || _stateManager$stateHo === void 0 || _stateManager$stateHo.forEach(function (hookFn) {
2329
+ hookFn(stateProp, newValue);
2330
+ });
2331
+ (_stateManager$stateHo2 = stateManager.stateHooks.get("$$ALL")) === null || _stateManager$stateHo2 === void 0 || _stateManager$stateHo2.forEach(function (hookFn) {
2332
+ hookFn(stateProp, newValue);
2333
+ });
2295
2334
  }
2296
2335
  function handleStateDependency(stateManager, depStateProp) {
2297
2336
  var appScope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : window;
@@ -2313,6 +2352,8 @@ function handleStateDependency(stateManager, depStateProp) {
2313
2352
  }
2314
2353
  }
2315
2354
  function isBuiltInStateProp(stateProp) {
2355
+ if (typeof stateProp !== "string") return false;
2356
+ if (stateProp.indexOf("$$") === 0) return true;
2316
2357
  return BUILT_IN_STATE_PROPS.has(stateProp);
2317
2358
  }
2318
2359
  function dispatchStateChangEvent(state, property, newValue) {
@@ -3225,7 +3266,9 @@ function populateStateFromInitialState(stateManager, initialState) {
3225
3266
 
3226
3267
  // If an array value was set to a new array,
3227
3268
  // then also count it as an array.length change!
3228
- stateManager.setDirtyProp("".concat(stateProp, ".length"));
3269
+ if (Array.isArray(value)) {
3270
+ stateManager.setDirtyProp("".concat(stateProp, ".length"));
3271
+ }
3229
3272
  },
3230
3273
  get: function get() {
3231
3274
  // Value is always retrieved from the "private" state
@@ -3535,7 +3578,6 @@ function makeReactive(stateObject) {
3535
3578
  }
3536
3579
  ;// ./src/Cougar/StateManager.js
3537
3580
  function StateManager_typeof(o) { "@babel/helpers - typeof"; return StateManager_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, StateManager_typeof(o); }
3538
- function StateManager_toArray(r) { return StateManager_arrayWithHoles(r) || StateManager_iterableToArray(r) || StateManager_unsupportedIterableToArray(r) || StateManager_nonIterableRest(); }
3539
3581
  function StateManager_toConsumableArray(r) { return StateManager_arrayWithoutHoles(r) || StateManager_iterableToArray(r) || StateManager_unsupportedIterableToArray(r) || StateManager_nonIterableSpread(); }
3540
3582
  function StateManager_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3541
3583
  function StateManager_iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
@@ -3611,6 +3653,9 @@ var StateManager = /*#__PURE__*/function () {
3611
3653
  // Node Manager saves bindings between Nodes and state,
3612
3654
  // translates state chanages into DOM actions and queue them for next paint.
3613
3655
  StateManager_defineProperty(this, "nodeManager", new NodeManager());
3656
+ // Each key in the map is a stateProp, value is a set of callback functions
3657
+ // to run when the state changes
3658
+ StateManager_defineProperty(this, "stateHooks", new Map());
3614
3659
  // Names of "plugins" that are turned on for the State Manager instance (e.g. "map", "conditional-element");
3615
3660
  StateManager_classPrivateFieldInitSpec(this, _plugins, new Set());
3616
3661
  this.isInitializing = true;
@@ -3626,6 +3671,10 @@ var StateManager = /*#__PURE__*/function () {
3626
3671
  this.state.populate = function (populateObject) {
3627
3672
  for (var property in populateObject) {
3628
3673
  if (this.hasOwnProperty(property)) {
3674
+ if (isBuiltInStateProp(property)) {
3675
+ if (false) {}
3676
+ continue;
3677
+ }
3629
3678
  this[property] = populateObject[property];
3630
3679
  }
3631
3680
  }
@@ -3887,13 +3936,14 @@ var StateManager = /*#__PURE__*/function () {
3887
3936
  }, {
3888
3937
  key: "bindStatePropExpression",
3889
3938
  value: function bindStatePropExpression(statePropExpression, type, args) {
3939
+ var contextStateProp = args[0];
3890
3940
  if (!type || !args) {
3891
3941
  var _parseStateExpression = parseStateExpression(statePropExpression);
3892
- var _parseStateExpression2 = StateManager_toArray(_parseStateExpression);
3942
+ var _parseStateExpression2 = StateManager_slicedToArray(_parseStateExpression, 2);
3893
3943
  type = _parseStateExpression2[0];
3894
- args = _parseStateExpression2.slice(1);
3944
+ args = _parseStateExpression2[1];
3945
+ contextStateProp = args[0];
3895
3946
  }
3896
- var contextStateProp = args[0];
3897
3947
  if (!contextStateProp) {
3898
3948
  throw Error("Must specify state property name for State expression: ".concat(statePropExpression));
3899
3949
  }
@@ -3972,6 +4022,31 @@ var StateManager = /*#__PURE__*/function () {
3972
4022
  value: function isUsing(pluginName) {
3973
4023
  return StateManager_classPrivateFieldGet(_plugins, this).has(pluginName);
3974
4024
  }
4025
+
4026
+ // State Hook functions are function that
4027
+ // run if stateProps change their value
4028
+ // they can be used by "plug-ins" to add extra
4029
+ // functionalities. If stateProps is undefined
4030
+ // they hook function will run for ANY state change.
4031
+ // stateProps can be an array of State props, to trigger
4032
+ // the State hook functions only for when those state props change
4033
+ }, {
4034
+ key: "addStateHook",
4035
+ value: function addStateHook(hookFunction) {
4036
+ var _this5 = this;
4037
+ var stateProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
4038
+ if (!stateProps.length) {
4039
+ var _this$stateHooks$get;
4040
+ var allPropsHooks = (_this$stateHooks$get = this.stateHooks.get("$$ALL")) !== null && _this$stateHooks$get !== void 0 ? _this$stateHooks$get : (this.stateHooks.set("$$ALL", new Set()), this.stateHooks.get("$$ALL"));
4041
+ allPropsHooks.add(hookFunction);
4042
+ } else {
4043
+ stateProps.forEach(function (stateProp) {
4044
+ var _this5$stateHooks$get;
4045
+ var propHooks = (_this5$stateHooks$get = _this5.stateHooks.get(stateProp)) !== null && _this5$stateHooks$get !== void 0 ? _this5$stateHooks$get : (_this5.stateHooks.set(stateProp, new Set()), _this5.stateHooks.get(stateProp));
4046
+ propHooks.add(hookFunction);
4047
+ });
4048
+ }
4049
+ }
3975
4050
  }]);
3976
4051
  }();
3977
4052
  /* harmony default export */ const Cougar_StateManager = (StateManager);
@@ -4578,52 +4653,16 @@ function toCamelCase(str) {
4578
4653
 
4579
4654
  // This is the script that takes Template elements from the page and defines Reactive Custom Elements
4580
4655
  /* harmony default export */ function build(appScope, appName) {
4581
- function defineCustomElementFromScript(_x, _x2) {
4582
- return _defineCustomElementFromScript.apply(this, arguments);
4583
- } // Create custom elements from templates
4584
- function _defineCustomElementFromScript() {
4585
- _defineCustomElementFromScript = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(elemName, globalStylesheet) {
4586
- var runtimeFnName, runtimeFn;
4587
- return _regeneratorRuntime().wrap(function _callee$(_context) {
4588
- while (1) switch (_context.prev = _context.next) {
4589
- case 0:
4590
- runtimeFnName = "SPROUT_".concat(toCamelCase(elemName), "_Runtime");
4591
- runtimeFn = globalThis[runtimeFnName];
4592
- customElements.define(elemName, /*#__PURE__*/function (_appScope$ReactiveCus) {
4593
- function _class() {
4594
- build_classCallCheck(this, _class);
4595
- return build_callSuper(this, _class, [undefined, runtimeFn, undefined, globalStylesheet]);
4596
- }
4597
- build_inherits(_class, _appScope$ReactiveCus);
4598
- return build_createClass(_class);
4599
- }(appScope.ReactiveCustomElement));
4600
-
4601
- // Also define the -dsd variation - to support Declartive Shadow DOM
4602
- customElements.define("".concat(elemName, "-dsd"), /*#__PURE__*/function (_appScope$ReactiveCus2) {
4603
- function _class2() {
4604
- build_classCallCheck(this, _class2);
4605
- return build_callSuper(this, _class2, [undefined, runtimeFn, undefined, globalStylesheet]);
4606
- }
4607
- build_inherits(_class2, _appScope$ReactiveCus2);
4608
- return build_createClass(_class2);
4609
- }(appScope.ReactiveCustomElement));
4610
- delete window[runtimeFnName];
4611
- case 5:
4612
- case "end":
4613
- return _context.stop();
4614
- }
4615
- }, _callee);
4616
- }));
4617
- return _defineCustomElementFromScript.apply(this, arguments);
4618
- }
4619
- function defineCustomElementFromTemplate(_x3, _x4, _x5) {
4656
+ var sprouteCustomElements = appScope.scopedCustomElementRegistry;
4657
+ // Create custom elements from templates
4658
+ function defineCustomElementFromTemplate(_x, _x2, _x3) {
4620
4659
  return _defineCustomElementFromTemplate.apply(this, arguments);
4621
4660
  }
4622
4661
  function _defineCustomElementFromTemplate() {
4623
- _defineCustomElementFromTemplate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(template, elemName, globalStylesheet) {
4662
+ _defineCustomElementFromTemplate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(template, elemName, globalStylesheet) {
4624
4663
  var templateContent, style, runtime, runtimeScript, runtimeCode;
4625
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
4626
- while (1) switch (_context2.prev = _context2.next) {
4664
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
4665
+ while (1) switch (_context.prev = _context.next) {
4627
4666
  case 0:
4628
4667
  templateContent = template.content;
4629
4668
  style = templateContent.querySelector('style');
@@ -4640,30 +4679,30 @@ function toCamelCase(str) {
4640
4679
  }
4641
4680
  }
4642
4681
  }
4643
- customElements.define(elemName, /*#__PURE__*/function (_appScope$ReactiveCus3) {
4644
- function _class3() {
4682
+ customElements.define(elemName, /*#__PURE__*/function (_appScope$ReactiveCus) {
4683
+ function _class() {
4645
4684
  var _style;
4646
- build_classCallCheck(this, _class3);
4647
- return build_callSuper(this, _class3, [templateContent, runtime, (_style = style) === null || _style === void 0 ? void 0 : _style.textContent, globalStylesheet]);
4685
+ build_classCallCheck(this, _class);
4686
+ return build_callSuper(this, _class, [templateContent, runtime, (_style = style) === null || _style === void 0 ? void 0 : _style.textContent, globalStylesheet]);
4648
4687
  }
4649
- build_inherits(_class3, _appScope$ReactiveCus3);
4650
- return build_createClass(_class3);
4688
+ build_inherits(_class, _appScope$ReactiveCus);
4689
+ return build_createClass(_class);
4651
4690
  }(appScope.ReactiveCustomElement));
4652
4691
 
4653
4692
  // Also define the -dsd variation - to support Declartive Shadow DOM
4654
- customElements.define("".concat(elemName, "-dsd"), /*#__PURE__*/function (_appScope$ReactiveCus4) {
4655
- function _class4() {
4656
- build_classCallCheck(this, _class4);
4657
- return build_callSuper(this, _class4, [templateContent, runtime, null, globalStylesheet, true]);
4693
+ customElements.define("".concat(elemName, "-dsd"), /*#__PURE__*/function (_appScope$ReactiveCus2) {
4694
+ function _class2() {
4695
+ build_classCallCheck(this, _class2);
4696
+ return build_callSuper(this, _class2, [templateContent, runtime, null, globalStylesheet, true]);
4658
4697
  }
4659
- build_inherits(_class4, _appScope$ReactiveCus4);
4660
- return build_createClass(_class4);
4698
+ build_inherits(_class2, _appScope$ReactiveCus2);
4699
+ return build_createClass(_class2);
4661
4700
  }(appScope.ReactiveCustomElement));
4662
4701
  case 7:
4663
4702
  case "end":
4664
- return _context2.stop();
4703
+ return _context.stop();
4665
4704
  }
4666
- }, _callee2);
4705
+ }, _callee);
4667
4706
  }));
4668
4707
  return _defineCustomElementFromTemplate.apply(this, arguments);
4669
4708
  }