Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@semantic-ui/templating

Package Overview
Dependencies
Maintainers
0
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@semantic-ui/templating - npm Package Compare versions

Comparing version 0.0.26 to 0.0.27

12

package.json

@@ -8,9 +8,9 @@ {

"dependencies": {
"@semantic-ui/component": "^0.0.26",
"@semantic-ui/query": "^0.0.26",
"@semantic-ui/reactivity": "^0.0.26",
"@semantic-ui/templating": "^0.0.26",
"@semantic-ui/utils": "^0.0.26"
"@semantic-ui/component": "^0.0.27",
"@semantic-ui/query": "^0.0.27",
"@semantic-ui/reactivity": "^0.0.27",
"@semantic-ui/templating": "^0.0.27",
"@semantic-ui/utils": "^0.0.27"
},
"version": "0.0.26"
"version": "0.0.27"
}

@@ -36,2 +36,5 @@ import { Reaction } from '@semantic-ui/reactivity';

},
either(a, b) {
return a || b;
},
classes(array = []) {

@@ -38,0 +41,0 @@ return array.join(' ') + ' ';

import { $ } from '@semantic-ui/query';
import { capitalize, fatal, each, remove, any, clone, generateID, getKeyFromEvent, isEqual, noop, isServer, inArray, isFunction, extend, wrapFunction } from '@semantic-ui/utils';
import { capitalize, fatal, each, remove, any, get, generateID, getKeyFromEvent, isEqual, noop, isServer, inArray, isFunction, extend, wrapFunction } from '@semantic-ui/utils';
import { ReactiveVar, Reaction } from '@semantic-ui/reactivity';

@@ -48,3 +48,3 @@

this.stateConfig = stateConfig;
this.state = this.createReactiveState(stateConfig) || {};
this.state = this.createReactiveState(stateConfig, data) || {};
this.templateName = templateName || this.getGenericTemplateName();

@@ -71,12 +71,24 @@ this.subTemplates = subTemplates;

createReactiveState(stateConfig) {
createReactiveState(stateConfig, data) {
let reactiveState = {};
// we want to allow data context to override default state
// this is most useful in subtemplates as state can be used
// as a substitute for settings because settings only works with tag attributes
let getInitialValue = (config, name) => {
const dataValue = get(data, name);
if(dataValue) {
return dataValue;
}
return config?.value || config;
};
each(stateConfig, (config, name) => {
if(config?.value && config?.options) {
const initialValue = getInitialValue(config, name);
if(config?.options) {
// complex config { counter: { value: 0, options: { equalityFunction }}}
reactiveState[name] = new ReactiveVar(config.value, config.options);
reactiveState[name] = new ReactiveVar(initialValue, config.options);
}
else {
// simple config i.e. { counter: 0 }
const initialValue = config;
reactiveState[name] = new ReactiveVar(initialValue);

@@ -101,3 +113,3 @@ }

parentTemplate._childTemplates.push(this);
this.parentTemplate = parentTemplate;
this.tpl._parentTemplate = parentTemplate;
}

@@ -153,2 +165,3 @@

data: this.getDataContext(),
template: this,
subTemplates: this.subTemplates,

@@ -242,6 +255,7 @@ helpers: TemplateHelpers,

};
return new Template({
const templateSettings = {
...defaultSettings,
...settings,
});
};
return new Template(templateSettings);
}

@@ -425,3 +439,3 @@

removeKey(key) {
unbindKey(key) {
delete this.keys[key];

@@ -535,2 +549,3 @@ }

reactiveVar: this.reactiveVar.bind(this),
afterFlush: Reaction.afterFlush,

@@ -548,2 +563,3 @@ data: this.data,

bindKey: this.bindKey.bind(this),
unbindKey: this.unbindKey.bind(this),
abortController: this.eventController,

@@ -580,4 +596,5 @@

attachEvent(selector, eventName, eventHandler, eventSettings) {
$(selector, document, { pierceShadow: true }).on(eventName, eventHandler, {
return $(selector, document, { pierceShadow: true }).on(eventName, eventHandler, {
abortController: this.eventController,
returnHandler: true,
...eventSettings

@@ -671,3 +688,3 @@ });

while (template) {
template = template.parentTemplate;
template = template._parentTemplate || template?.tpl?._parentTemplate;
if (!match && template?.templateName == templateName) {

@@ -674,0 +691,0 @@ match = template;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc