sygnal 2.9.0 → 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/dist/index.cjs.js +14 -2
- package/dist/index.esm.js +14 -2
- package/dist/jsx.cjs.js +7 -5144
- package/dist/jsx.esm.js +7 -5144
- package/dist/sygnal.min.js +1 -1
- package/package.json +1 -1
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) || {};
|
|
@@ -4656,6 +4660,14 @@ function logDriver(out$) {
|
|
|
4656
4660
|
|
|
4657
4661
|
function run(app, drivers={}, options={}) {
|
|
4658
4662
|
const { mountPoint='#root', fragments=true } = options;
|
|
4663
|
+
if (!app.isSygnalComponent) {
|
|
4664
|
+
const name = app.name || "FUNCTIONAL_COMPONENT";
|
|
4665
|
+
const view = app;
|
|
4666
|
+
const { model, intent, context, children, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug } = app;
|
|
4667
|
+
const options = { name, view, model, intent, context, children, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug };
|
|
4668
|
+
|
|
4669
|
+
app = component(options);
|
|
4670
|
+
}
|
|
4659
4671
|
|
|
4660
4672
|
const wrapped = state.withState(app, 'STATE');
|
|
4661
4673
|
|
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) || {};
|
|
@@ -4656,6 +4660,14 @@ function logDriver(out$) {
|
|
|
4656
4660
|
|
|
4657
4661
|
function run(app, drivers={}, options={}) {
|
|
4658
4662
|
const { mountPoint='#root', fragments=true } = options;
|
|
4663
|
+
if (!app.isSygnalComponent) {
|
|
4664
|
+
const name = app.name || "FUNCTIONAL_COMPONENT";
|
|
4665
|
+
const view = app;
|
|
4666
|
+
const { model, intent, context, children, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug } = app;
|
|
4667
|
+
const options = { name, view, model, intent, context, children, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug };
|
|
4668
|
+
|
|
4669
|
+
app = component(options);
|
|
4670
|
+
}
|
|
4659
4671
|
|
|
4660
4672
|
const wrapped = withState(app, 'STATE');
|
|
4661
4673
|
|