sygnal 2.9.0 → 2.9.1

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/dist/index.cjs.js CHANGED
@@ -4145,6 +4145,10 @@ class Component {
4145
4145
  const stateSource = new state.StateSource(combined$);
4146
4146
  const stateField = props.state;
4147
4147
 
4148
+ if (typeof props.sygnalFactory !== 'function' && typeof props.sygnalOptions === 'object') {
4149
+ props.sygnalFactory = component(props.sygnalOptions);
4150
+ }
4151
+
4148
4152
  const factory = componentName === 'sygnal-factory' ? props.sygnalFactory : (this.components[componentName] || props.sygnalFactory);
4149
4153
  if (!factory) {
4150
4154
  if (componentName === 'sygnal-factory') throw new Error(`Component not found on element with Capitalized selector and nameless function: JSX transpilation replaces selectors starting with upper case letters with functions in-scope with the same name, Sygnal cannot see the name of the resulting component.`)
@@ -4293,7 +4297,7 @@ function getComponents(currentElement, componentNames, depth=0, index=0, parentI
4293
4297
  const sel = currentElement.sel;
4294
4298
  const isCollection = sel && sel.toLowerCase() === 'collection';
4295
4299
  const isSwitchable = sel && sel.toLowerCase() === 'switchable';
4296
- const isComponent = sel && (['collection', 'switchable', 'sygnal-factory', ...componentNames].includes(sel)) || typeof currentElement.data?.props?.sygnalFactory === 'function';
4300
+ const isComponent = sel && (['collection', 'switchable', 'sygnal-factory', ...componentNames].includes(sel)) || typeof currentElement.data?.props?.sygnalFactory === 'function' || typeof currentElement.data?.props?.sygnalOptions === 'object';
4297
4301
  const props = (currentElement.data && currentElement.data.props) || {};
4298
4302
  (currentElement.data && currentElement.data.attrs) || {};
4299
4303
  const children = currentElement.children || [];
@@ -4341,7 +4345,7 @@ function injectComponents(currentElement, components, componentNames, depth=0, i
4341
4345
 
4342
4346
 
4343
4347
  const sel = currentElement.sel || 'NO SELECTOR';
4344
- const isComponent = ['collection', 'switchable', 'sygnal-factory', ...componentNames].includes(sel) || typeof currentElement.data?.props?.sygnalFactory === 'function';
4348
+ const isComponent = ['collection', 'switchable', 'sygnal-factory', ...componentNames].includes(sel) || typeof currentElement.data?.props?.sygnalFactory === 'function' || typeof currentElement.data?.props?.sygnalOptions === 'object';
4345
4349
  const isCollection = currentElement?.data?.isCollection;
4346
4350
  const isSwitchable = currentElement?.data?.isSwitchable;
4347
4351
  (currentElement.data && currentElement.data.props) || {};
package/dist/index.esm.js CHANGED
@@ -4145,6 +4145,10 @@ class Component {
4145
4145
  const stateSource = new StateSource(combined$);
4146
4146
  const stateField = props.state;
4147
4147
 
4148
+ if (typeof props.sygnalFactory !== 'function' && typeof props.sygnalOptions === 'object') {
4149
+ props.sygnalFactory = component(props.sygnalOptions);
4150
+ }
4151
+
4148
4152
  const factory = componentName === 'sygnal-factory' ? props.sygnalFactory : (this.components[componentName] || props.sygnalFactory);
4149
4153
  if (!factory) {
4150
4154
  if (componentName === 'sygnal-factory') throw new Error(`Component not found on element with Capitalized selector and nameless function: JSX transpilation replaces selectors starting with upper case letters with functions in-scope with the same name, Sygnal cannot see the name of the resulting component.`)
@@ -4293,7 +4297,7 @@ function getComponents(currentElement, componentNames, depth=0, index=0, parentI
4293
4297
  const sel = currentElement.sel;
4294
4298
  const isCollection = sel && sel.toLowerCase() === 'collection';
4295
4299
  const isSwitchable = sel && sel.toLowerCase() === 'switchable';
4296
- const isComponent = sel && (['collection', 'switchable', 'sygnal-factory', ...componentNames].includes(sel)) || typeof currentElement.data?.props?.sygnalFactory === 'function';
4300
+ const isComponent = sel && (['collection', 'switchable', 'sygnal-factory', ...componentNames].includes(sel)) || typeof currentElement.data?.props?.sygnalFactory === 'function' || typeof currentElement.data?.props?.sygnalOptions === 'object';
4297
4301
  const props = (currentElement.data && currentElement.data.props) || {};
4298
4302
  (currentElement.data && currentElement.data.attrs) || {};
4299
4303
  const children = currentElement.children || [];
@@ -4341,7 +4345,7 @@ function injectComponents(currentElement, components, componentNames, depth=0, i
4341
4345
 
4342
4346
 
4343
4347
  const sel = currentElement.sel || 'NO SELECTOR';
4344
- const isComponent = ['collection', 'switchable', 'sygnal-factory', ...componentNames].includes(sel) || typeof currentElement.data?.props?.sygnalFactory === 'function';
4348
+ const isComponent = ['collection', 'switchable', 'sygnal-factory', ...componentNames].includes(sel) || typeof currentElement.data?.props?.sygnalFactory === 'function' || typeof currentElement.data?.props?.sygnalOptions === 'object';
4345
4349
  const isCollection = currentElement?.data?.isCollection;
4346
4350
  const isSwitchable = currentElement?.data?.isSwitchable;
4347
4351
  (currentElement.data && currentElement.data.props) || {};