@teleporthq/teleport-plugin-common
Advanced tools
Comparing version 0.16.0 to 0.16.2
import * as types from '@babel/types'; | ||
import { ImportIdentifier, UIDLEventHandlerStatement, EntryFileOptions, UIDLGlobalAsset } from '@teleporthq/teleport-types'; | ||
import { ImportIdentifier, EntryFileOptions, UIDLGlobalAsset, UIDLStateModifierEvent } from '@teleporthq/teleport-types'; | ||
export declare const createConstAssignment: (constName: string, asignment?: any, t?: typeof types) => types.VariableDeclaration; | ||
@@ -18,3 +18,3 @@ export declare const createDefaultExport: (exportReference: string, t?: typeof types) => types.ExportDefaultDeclaration; | ||
export declare const createComponentDecorator: (params: Record<string, unknown>, t?: typeof types) => types.Decorator; | ||
export declare const createStateChangeStatement: (statement: UIDLEventHandlerStatement, t?: typeof types) => types.ExpressionStatement; | ||
export declare const createStateChangeStatement: (statement: UIDLStateModifierEvent, t?: typeof types) => types.ExpressionStatement; | ||
export declare const appendAssetsAST: (assets: UIDLGlobalAsset[], options: EntryFileOptions, headNode: types.JSXElement, bodyNode: types.JSXElement) => void; |
@@ -50,8 +50,7 @@ "use strict"; | ||
var statement = eventHandlerStatements[0]; | ||
var isPropEvent = statement && statement.type === 'propCall' && statement.calls; | ||
if (isPropEvent) { | ||
if (statement.type === 'propCall' && statement.calls) { | ||
var eventEmitter = templateSyntax.eventEmmitter(statement.calls); | ||
hastUtils.addAttributeToNode(htmlNode, eventHandlerKey, eventEmitter); | ||
} | ||
else { | ||
if (statement.type === 'stateChange') { | ||
hastUtils.addAttributeToNode(htmlNode, eventHandlerKey, statement.newState === '$toggle' | ||
@@ -58,0 +57,0 @@ ? statement.modifies + " = !" + statement.modifies |
import * as types from '@babel/types'; | ||
import { ImportIdentifier, UIDLEventHandlerStatement, EntryFileOptions, UIDLGlobalAsset } from '@teleporthq/teleport-types'; | ||
import { ImportIdentifier, EntryFileOptions, UIDLGlobalAsset, UIDLStateModifierEvent } from '@teleporthq/teleport-types'; | ||
export declare const createConstAssignment: (constName: string, asignment?: any, t?: typeof types) => types.VariableDeclaration; | ||
@@ -18,3 +18,3 @@ export declare const createDefaultExport: (exportReference: string, t?: typeof types) => types.ExportDefaultDeclaration; | ||
export declare const createComponentDecorator: (params: Record<string, unknown>, t?: typeof types) => types.Decorator; | ||
export declare const createStateChangeStatement: (statement: UIDLEventHandlerStatement, t?: typeof types) => types.ExpressionStatement; | ||
export declare const createStateChangeStatement: (statement: UIDLStateModifierEvent, t?: typeof types) => types.ExpressionStatement; | ||
export declare const appendAssetsAST: (assets: UIDLGlobalAsset[], options: EntryFileOptions, headNode: types.JSXElement, bodyNode: types.JSXElement) => void; |
@@ -41,8 +41,7 @@ import * as hastUtils from '../../utils/hast-utils'; | ||
const statement = eventHandlerStatements[0]; | ||
const isPropEvent = statement && statement.type === 'propCall' && statement.calls; | ||
if (isPropEvent) { | ||
if (statement.type === 'propCall' && statement.calls) { | ||
const eventEmitter = templateSyntax.eventEmmitter(statement.calls); | ||
hastUtils.addAttributeToNode(htmlNode, eventHandlerKey, eventEmitter); | ||
} | ||
else { | ||
if (statement.type === 'stateChange') { | ||
hastUtils.addAttributeToNode(htmlNode, eventHandlerKey, statement.newState === '$toggle' | ||
@@ -49,0 +48,0 @@ ? `${statement.modifies} = !${statement.modifies}` |
{ | ||
"name": "@teleporthq/teleport-plugin-common", | ||
"version": "0.16.0", | ||
"version": "0.16.2", | ||
"description": "Common building and modelating functions for ASTs and HASTs", | ||
@@ -30,8 +30,8 @@ "author": "teleportHQ", | ||
"@babel/types": "^7.5.5", | ||
"@teleporthq/teleport-shared": "^0.16.0", | ||
"@teleporthq/teleport-types": "^0.16.0", | ||
"@teleporthq/teleport-shared": "^0.16.2", | ||
"@teleporthq/teleport-types": "^0.16.2", | ||
"jss": "^10.0.0", | ||
"jss-preset-default": "^10.0.0" | ||
}, | ||
"gitHead": "87531fab68231f166de64fdd5a2a212fdab8f0c9" | ||
"gitHead": "f1eee6eb7665c71c8b65b6d33f2d8bd70c0235c2" | ||
} |
@@ -10,5 +10,5 @@ import * as types from '@babel/types' | ||
ImportIdentifier, | ||
UIDLEventHandlerStatement, | ||
EntryFileOptions, | ||
UIDLGlobalAsset, | ||
UIDLStateModifierEvent, | ||
} from '@teleporthq/teleport-types' | ||
@@ -168,3 +168,3 @@ import { UIDLUtils } from '@teleporthq/teleport-shared' | ||
export const createStateChangeStatement = (statement: UIDLEventHandlerStatement, t = types) => { | ||
export const createStateChangeStatement = (statement: UIDLStateModifierEvent, t = types) => { | ||
const { modifies, newState } = statement | ||
@@ -171,0 +171,0 @@ |
@@ -73,8 +73,9 @@ import * as hastUtils from '../../utils/hast-utils' | ||
const statement = eventHandlerStatements[0] | ||
const isPropEvent = statement && statement.type === 'propCall' && statement.calls | ||
if (isPropEvent) { | ||
if (statement.type === 'propCall' && statement.calls) { | ||
const eventEmitter = templateSyntax.eventEmmitter(statement.calls) | ||
hastUtils.addAttributeToNode(htmlNode, eventHandlerKey, eventEmitter) | ||
} else { | ||
} | ||
if (statement.type === 'stateChange') { | ||
hastUtils.addAttributeToNode( | ||
@@ -81,0 +82,0 @@ htmlNode, |
@@ -12,2 +12,4 @@ import * as types from '@babel/types' | ||
UIDLConditionalExpression, | ||
UIDLPropCallEvent, | ||
UIDLStateModifierEvent, | ||
} from '@teleporthq/teleport-types' | ||
@@ -71,3 +73,3 @@ | ||
const createPropCallStatement = ( | ||
eventHandlerStatement: UIDLEventHandlerStatement, | ||
eventHandlerStatement: UIDLPropCallEvent, | ||
propDefinitions: Record<string, UIDLPropDefinition>, | ||
@@ -102,3 +104,3 @@ options: JSXGenerationOptions, | ||
const createStateChangeStatement = ( | ||
eventHandlerStatement: UIDLEventHandlerStatement, | ||
eventHandlerStatement: UIDLStateModifierEvent, | ||
stateDefinitions: Record<string, UIDLStateDefinition>, | ||
@@ -105,0 +107,0 @@ options: JSXGenerationOptions, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
587200