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

@semantic-ui/component

Package Overview
Dependencies
Maintainers
0
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@semantic-ui/component - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

10

package.json

@@ -15,8 +15,8 @@ {

"dependencies": {
"@semantic-ui/query": "^0.1.5",
"@semantic-ui/reactivity": "^0.1.5",
"@semantic-ui/templating": "^0.1.5",
"@semantic-ui/utils": "^0.1.5"
"@semantic-ui/query": "^0.1.6",
"@semantic-ui/reactivity": "^0.1.6",
"@semantic-ui/templating": "^0.1.6",
"@semantic-ui/utils": "^0.1.6"
},
"version": "0.1.5"
"version": "0.1.6"
}

@@ -0,5 +1,7 @@

import { noChange } from 'lit';
import { directive } from 'lit/directive.js';
import { AsyncDirective } from 'lit/async-directive.js';
import { Reaction } from '@semantic-ui/reactivity';
import { fatal, mapObject } from '@semantic-ui/utils';
import { fatal, isString, mapObject } from '@semantic-ui/utils';
import { Template } from '@semantic-ui/templating';

@@ -14,3 +16,3 @@ // Define directive

}
render({ getTemplateName, templateName, subTemplates, data, parentTemplate }) {
render({ getTemplate, templateName, subTemplates, data, parentTemplate }) {
const unpackData = (dataObj) => {

@@ -21,6 +23,29 @@ return mapObject(dataObj, (val) => val());

const templateName = getTemplateName();
// expression can evaluate to a template or a string
// in the case of a string we will pull from subtemplates
let templateName;
let template;
// check if the template name is set and is the same as current
if (this.template && this.templateName == templateName) {
const templateOrName = getTemplate();
// find template to render
if(isString(templateOrName)) {
templateName = templateOrName;
template = subTemplates[templateName];
if (!template) {
fatal(
`Could not find template named "${templateName}"`,
subTemplates
);
return false;
}
}
else if(templateOrName instanceof Template) {
// support passing in full templates using expressions
template = templateOrName;
templateName = template.templateName;
}
// avoid recreating prototype if rendered already
if(templateName == this.templateName) {
return false;

@@ -30,10 +55,2 @@ }

// find template to render
const template = subTemplates[templateName];
if (!template) {
fatal(
`Could not find template named "${getTemplateName()}"`,
subTemplates
);
}
// clone if it has changed

@@ -40,0 +57,0 @@ this.template = template.clone({ templateName, subTemplates, data: unpackData(data) });

@@ -228,3 +228,3 @@ import { html, svg } from 'lit';

templateName: node.name,
getTemplateName: () => this.evaluateExpression(node.name, data), // template name can be dynamic
getTemplate: () => this.evaluateExpression(node.name, data), // template can be dynamic
data: templateData,

@@ -231,0 +231,0 @@ parentTemplate: this.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