From 185b1413253ed99fb2ac693dcabde5b4dddb62c7 Mon Sep 17 00:00:00 2001
From: harttle
Date: Thu, 29 Aug 2019 16:52:44 +0800
Subject: [PATCH] feat: support more cases
---
.php_cs.cache | 2 +-
src/php-ssr.js | 381 ++----------------
test/cases/elif-update-all-false/ssr.js | 10 +-
test/cases/elif-update-all-false/ssr.php | 55 +++
test/cases/s-html/ssr.js | 10 +-
test/cases/s-html/ssr.php | 49 +++
.../cases/scoped-slot-default-listened/ssr.js | 24 +-
.../scoped-slot-default-listened/ssr.php | 127 ++++++
test/cases/slot-desc-for-true/ssr.js | 52 +--
test/cases/slot-desc-for-true/ssr.php | 166 ++++++++
test/cases/slot-desc-if-true/ssr.js | 28 +-
test/cases/slot-desc-if-true/ssr.php | 157 ++++++++
test/cases/slot-insert-ele-for/ssr.js | 44 +-
test/cases/slot-insert-ele-for/ssr.php | 168 ++++++++
test/cases/slot-insert-ele-if/ssr.js | 28 +-
test/cases/slot-insert-ele-if/ssr.php | 179 ++++++++
test/cases/slot-named-content-default/ssr.js | 28 +-
test/cases/slot-named-content-default/ssr.php | 157 ++++++++
test/cases/slot-shake-desc-ele-name/ssr.js | 138 +++----
test/cases/slot-shake-desc-ele-name/ssr.php | 172 ++++++++
test/cases/style-and-class-autoexpand/ssr.js | 20 +-
test/cases/style-and-class-autoexpand/ssr.php | 99 +++++
test/cases/text-value-binding/ssr.js | 10 +-
test/cases/text-value-binding/ssr.php | 57 +++
test/cases/textarea-value-binding/ssr.js | 10 +-
test/cases/textarea-value-binding/ssr.php | 55 +++
test/cases/update-attribute/ssr.js | 10 +-
test/cases/update-attribute/ssr.php | 53 +++
test/cases/update-cmpt-has-attr/ssr.js | 20 +-
test/cases/update-cmpt-has-attr/ssr.php | 103 +++++
test/cases/update-cmpt/ssr.js | 20 +-
test/cases/update-cmpt/ssr.php | 107 +++++
.../ssr.js | 10 +-
.../ssr.php | 53 +++
test/cases/update-text/ssr.php | 53 +++
35 files changed, 2076 insertions(+), 579 deletions(-)
create mode 100644 test/cases/elif-update-all-false/ssr.php
create mode 100644 test/cases/s-html/ssr.php
create mode 100644 test/cases/scoped-slot-default-listened/ssr.php
create mode 100644 test/cases/slot-desc-for-true/ssr.php
create mode 100644 test/cases/slot-desc-if-true/ssr.php
create mode 100644 test/cases/slot-insert-ele-for/ssr.php
create mode 100644 test/cases/slot-insert-ele-if/ssr.php
create mode 100644 test/cases/slot-named-content-default/ssr.php
create mode 100644 test/cases/slot-shake-desc-ele-name/ssr.php
create mode 100644 test/cases/style-and-class-autoexpand/ssr.php
create mode 100644 test/cases/text-value-binding/ssr.php
create mode 100644 test/cases/textarea-value-binding/ssr.php
create mode 100644 test/cases/update-attribute/ssr.php
create mode 100644 test/cases/update-cmpt-has-attr/ssr.php
create mode 100644 test/cases/update-cmpt/ssr.php
create mode 100644 test/cases/update-text-whitespace-before-comment/ssr.php
create mode 100644 test/cases/update-text/ssr.php
diff --git a/.php_cs.cache b/.php_cs.cache
index f3f12093..173342da 100644
--- a/.php_cs.cache
+++ b/.php_cs.cache
@@ -1 +1 @@
-{"php":"7.3.8","version":"2.15.1:v2.15.1#20064511ab796593a3990669eff5f5b535001f7c","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_constants":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true},"hashes":{"\/tmp\/vW6aolH\/2\/precode.php":1055820987,"\/tmp\/vW6aolH\/5\/precode.php":1055820987,"\/tmp\/vW6aolH\/10\/precode.php":1055820987,"\/tmp\/v8lP4Pr\/19\/precode.php":3830120851,"\/tmp\/vglPZER\/1202\/San.php":1939724901,"\/tmp\/v2hKxnm\/74\/ssr.php":2976412624}}
\ No newline at end of file
+{"php":"7.3.8","version":"2.15.1:v2.15.1#20064511ab796593a3990669eff5f5b535001f7c","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_constants":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true},"hashes":{"\/tmp\/vW6aolH\/2\/precode.php":1055820987,"\/tmp\/vW6aolH\/5\/precode.php":1055820987,"\/tmp\/vW6aolH\/10\/precode.php":1055820987,"\/tmp\/v8lP4Pr\/19\/precode.php":3830120851,"\/tmp\/vglPZER\/1202\/San.php":1939724901,"\/tmp\/v2hKxnm\/74\/ssr.php":2976412624,"\/tmp\/vMJocIE\/3\/ssr.php":3567907173,"\/tmp\/vMJocIE\/8\/ssr.php":3567907173,"\/tmp\/vMJocIE\/21\/ssr.php":1828910878,"\/tmp\/vMJocIE\/29\/ssr.php":2020623447,"\/tmp\/vMJocIE\/44\/ssr.php":1781916730,"\/tmp\/vMJocIE\/121\/ssr.php":879048435,"\/tmp\/vMJocIE\/175\/ssr.php":1630225453,"\/tmp\/vMJocIE\/479\/ssr.php":2759521937,"\/tmp\/vMJocIE\/496\/ssr.php":605249896,"\/tmp\/vMJocIE\/633\/ssr.php":1783451590,"\/tmp\/vMJocIE\/769\/ssr.php":2170056779,"\/tmp\/vMJocIE\/816\/ssr.php":1826389859,"\/tmp\/vMJocIE\/819\/ssr.php":2222188087}}
\ No newline at end of file
diff --git a/src/php-ssr.js b/src/php-ssr.js
index 8f88fc1d..2cf6582d 100644
--- a/src/php-ssr.js
+++ b/src/php-ssr.js
@@ -42,7 +42,7 @@ const compileExprSource = {
code += `[${getKey(path)}]`
}
})
- return `(array_key_exists(${key}, ${code}) ? ${code}[${key}] : null)`
+ return `(isset(${code}[${key}]) ? ${code}[${key}] : null)`
function getKey (path) {
if (path.type === 4) return compileExprSource.dataAccess(path)
@@ -401,7 +401,7 @@ class CompileSourceBuffer {
switch (seg.type) {
case 'JOIN_DATA_STRINGIFY':
code.push('$html .= "";')
+ compileExprSource.dataAccess() + ', JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . "-->";')
break
case 'JOIN_EXPR':
@@ -632,47 +632,6 @@ if (ie === 9) {
*/
const autoCloseTags = splitStr2Obj('area,base,br,col,embed,hr,img,input,keygen,param,source,track,wbr')
-/**
-* 创建数据检测函数
-*
-* @param {Object} dataTypes 数据格式
-* @param {string} componentName 组件名
-* @return {Function}
-*/
-function createDataTypesChecker (dataTypes, componentName) {
- /**
- * 校验 data 是否满足 data types 的格式
- *
- * @param {*} data 数据
- */
- return function (data) {
- for (const dataTypeName in dataTypes) {
- /* istanbul ignore else */
- if (dataTypes.hasOwnProperty(dataTypeName)) {
- const dataTypeChecker = dataTypes[dataTypeName]
-
- if (typeof dataTypeChecker !== 'function') {
- throw new Error('[SAN ERROR] ' +
- componentName + ':' + dataTypeName + ' is invalid; ' +
- 'it must be a function, usually from san.DataTypes'
- )
- }
-
- dataTypeChecker(
- data,
- dataTypeName,
- componentName,
- dataTypeName
- )
- }
- }
- }
-}
-
-// #[end]
-
-// module.exports = createDataTypesChecker;
-
/**
* 字符串源码读取类,用于模板字符串解析过程
*
@@ -6097,258 +6056,6 @@ TemplateNode.prototype._update = function (changes) {
}
}
-/**
-* ANode预热,分析的数据引用等信息
-*
-* @param {Object} aNode 要预热的ANode
-*/
-function preheatANode (aNode) {
- const stack = []
-
- function recordHotspotData (expr, notContentData) {
- const refs = analyseExprDataHotspot(expr)
-
- if (refs.length) {
- for (let i = 0, len = stack.length; i < len; i++) {
- if (!notContentData || i !== len - 1) {
- let data = stack[i].hotspot.data
- if (!data) {
- data = stack[i].hotspot.data = {}
- }
-
- each(refs, function (ref) {
- data[ref] = 1
- })
- }
- }
- }
- }
-
- function analyseANodeHotspot (aNode) {
- if (!aNode.hotspot) {
- stack.push(aNode)
-
- if (aNode.textExpr) {
- aNode.hotspot = {}
- aNode.Clazz = TextNode
- recordHotspotData(aNode.textExpr)
- } else {
- let sourceNode
- if (isBrowser && aNode.tagName &&
- aNode.tagName.indexOf('-') < 0 &&
- !/^(template|slot|select|input|option|button|video|audio|canvas|img|embed|object|iframe)$/i.test(aNode.tagName)
- ) {
- sourceNode = createEl(aNode.tagName)
- }
-
- aNode.hotspot = {
- dynamicProps: [],
- xProps: [],
- props: {},
- sourceNode: sourceNode
- }
-
- // === analyse hotspot data: start
- each(aNode.vars, function (varItem) {
- recordHotspotData(varItem.expr)
- })
-
- each(aNode.props, function (prop) {
- recordHotspotData(prop.expr)
- })
-
- for (const key in aNode.directives) {
- /* istanbul ignore else */
- if (aNode.directives.hasOwnProperty(key)) {
- const directive = aNode.directives[key]
- recordHotspotData(
- directive.value,
- !/^(html|bind)$/.test(key)
- )
-
- // init trackBy getKey function
- if (key === 'for') {
- const trackBy = directive.trackBy
- if (trackBy &&
- trackBy.type === 4 &&
- trackBy.paths[0].value === directive.item
- ) {
- aNode.hotspot.getForKey = new Function( // eslint-disable-line
- directive.item,
- 'return ' + trackBy.raw
- )
- }
- }
- }
- }
-
- each(aNode.elses, function (child) {
- analyseANodeHotspot(child)
- })
-
- each(aNode.children, function (child) {
- analyseANodeHotspot(child)
- })
- // === analyse hotspot data: end
-
- // === analyse hotspot props: start
- each(aNode.props, function (prop, index) {
- aNode.hotspot.props[prop.name] = index
- prop.handler = getPropHandler(aNode.tagName, prop.name)
-
- if (prop.name === 'id') {
- prop.id = true
- aNode.hotspot.idProp = prop
- aNode.hotspot.dynamicProps.push(prop)
- } else if (prop.expr.value != null) {
- if (sourceNode) {
- prop.handler(sourceNode, prop.expr.value, prop.name, aNode)
- }
- } else {
- if (prop.x) {
- aNode.hotspot.xProps.push(prop)
- }
- aNode.hotspot.dynamicProps.push(prop)
- }
- })
-
- // ie 下,如果 option 没有 value 属性,select.value = xx 操作不会选中 option
- // 所以没有设置 value 时,默认把 option 的内容作为 value
- if (aNode.tagName === 'option' &&
- !getANodeProp(aNode, 'value') &&
- aNode.children[0]
- ) {
- const valueProp = {
- name: 'value',
- expr: aNode.children[0].textExpr,
- handler: getPropHandler(aNode.tagName, 'value')
- }
- aNode.props.push(valueProp)
- aNode.hotspot.dynamicProps.push(valueProp)
- aNode.hotspot.props.value = aNode.props.length - 1
- }
-
- if (aNode.directives['if']) { // eslint-disable-line dot-notation
- aNode.ifRinsed = {
- children: aNode.children,
- props: aNode.props,
- events: aNode.events,
- tagName: aNode.tagName,
- vars: aNode.vars,
- hotspot: aNode.hotspot,
- directives: extend({}, aNode.directives)
- }
- aNode.Clazz = IfNode
- aNode = aNode.ifRinsed
- aNode.directives['if'] = null // eslint-disable-line dot-notation
- }
-
- if (aNode.directives['for']) { // eslint-disable-line dot-notation
- aNode.forRinsed = {
- children: aNode.children,
- props: aNode.props,
- events: aNode.events,
- tagName: aNode.tagName,
- vars: aNode.vars,
- hotspot: aNode.hotspot,
- directives: extend({}, aNode.directives)
- }
- aNode.Clazz = ForNode
- aNode.forRinsed.directives['for'] = null // eslint-disable-line dot-notation
- aNode = aNode.forRinsed
- }
-
- switch (aNode.tagName) {
- case 'slot':
- aNode.Clazz = SlotNode
- break
-
- case 'template':
- aNode.Clazz = TemplateNode
- }
- // === analyse hotspot props: end
- }
-
- stack.pop()
- }
- }
-
- if (aNode) {
- analyseANodeHotspot(aNode)
- }
-}
-
-/**
-* 分析表达式的数据引用
-*
-* @param {Object} expr 要分析的表达式
-* @return {Array}
-*/
-function analyseExprDataHotspot (expr, accessorMeanDynamic) {
- let refs = []
- let isDynamic
-
- function analyseExprs (exprs, accessorMeanDynamic) {
- for (let i = 0, l = exprs.length; i < l; i++) {
- refs = refs.concat(analyseExprDataHotspot(exprs[i], accessorMeanDynamic))
- isDynamic = isDynamic || exprs[i].dynamic
- }
- }
-
- switch (expr.type) {
- case 4:
- isDynamic = accessorMeanDynamic
-
- const paths = expr.paths
- refs.push(paths[0].value)
-
- if (paths.length > 1) {
- refs.push(paths[0].value + '.' + (paths[1].value || '*'))
- }
-
- analyseExprs(paths.slice(1), 1)
- break
-
- case 9:
- refs = analyseExprDataHotspot(expr.expr, accessorMeanDynamic)
- isDynamic = expr.expr.dynamic
- break
-
- case 7:
- case 8:
- case 10:
- analyseExprs(expr.segs, accessorMeanDynamic)
- break
-
- case 5:
- refs = analyseExprDataHotspot(expr.expr)
- isDynamic = expr.expr.dynamic
-
- each(expr.filters, function (filter) {
- analyseExprs(filter.name.paths)
- analyseExprs(filter.args)
- })
-
- break
-
- case 6:
- analyseExprs(expr.name.paths)
- analyseExprs(expr.args)
- break
-
- case 12:
- case 11:
- for (let i = 0; i < expr.items.length; i++) {
- refs = refs.concat(analyseExprDataHotspot(expr.items[i].expr))
- isDynamic = isDynamic || expr.items[i].expr.dynamic
- }
- break
- }
-
- isDynamic && (expr.dynamic = true)
- return refs
-}
-
/**
* 将 binds 的 name 从 kebabcase 转换成 camelcase
*
@@ -6641,8 +6348,7 @@ const elementSourceCompiler = {
if (bindDirective) {
sourceBuffer.addRaw(
- '(function ($bindObj) {for (var $key in $bindObj) {' +
- 'var $value = $bindObj[$key];'
+ '(function ($bindObj) {foreach ($bindObj as $key => $value) {'
)
if (tagName === 'textarea') {
@@ -6882,33 +6588,13 @@ const aNodeCompiler = {
const indexName = forDirective.index || genSSRId()
const listName = genSSRId()
- sourceBuffer.addRaw('var ' + listName + ' = ' + compileExprSource.expr(forDirective.value) + ';')
- sourceBuffer.addRaw('if (' + listName + ' instanceof Array) {')
+ sourceBuffer.addRaw('$' + listName + ' = ' + compileExprSource.expr(forDirective.value) + ';')
+ sourceBuffer.addRaw('if (is_array($' + listName + ')) {')
// for array
- sourceBuffer.addRaw('for (' +
- '$' + indexName + ' = 0; ' +
- indexName + ' < ' + listName + '.length; ' +
- indexName + '++) {'
- )
- sourceBuffer.addRaw(`$componentCtx["data"]["${indexName}"] = ${indexName};`)
- sourceBuffer.addRaw(`$componentCtx["data"]["${itemName}"] = ${listName}[$${indexName}];`)
- sourceBuffer.addRaw(
- aNodeCompiler.compile(
- forElementANode,
- sourceBuffer,
- owner
- )
- )
- sourceBuffer.addRaw('}')
-
- sourceBuffer.addRaw('} else if (typeof ' + listName + ' === "object") {')
-
- // for object
- sourceBuffer.addRaw(`foreach ($${listName} as $${indexName}) {`)
- sourceBuffer.addRaw(`if (array_key_exists(${indexName}, $${listName})) {`)
+ sourceBuffer.addRaw(`foreach ($${listName} as $${indexName} => $value) {`)
sourceBuffer.addRaw(`$componentCtx["data"]["${indexName}"] = $${indexName};`)
- sourceBuffer.addRaw(`$componentCtx["data"]["${itemName}"] = $${listName}[$${indexName}];`)
+ sourceBuffer.addRaw(`$componentCtx["data"]["${itemName}"] = $value;`)
sourceBuffer.addRaw(
aNodeCompiler.compile(
forElementANode,
@@ -6918,8 +6604,6 @@ const aNodeCompiler = {
)
sourceBuffer.addRaw('}')
sourceBuffer.addRaw('}')
-
- sourceBuffer.addRaw('}')
},
/**
@@ -6932,16 +6616,16 @@ const aNodeCompiler = {
compileSlot: function (aNode, sourceBuffer, owner) {
const rendererId = genSSRId()
- sourceBuffer.addRaw(`$componentCtx["slotRenderers"]["${rendererId}"]` +
- ` = array_key_exists("${rendererId}", $componentCtx["slotRenderers"]) ? $componentCtx["slotRenderers"]["${rendererId}"] : function () {`)
+ sourceBuffer.addRaw(`if (!isset($componentCtx["slotRenderers"]["${rendererId}"])) ` +
+ `$componentCtx["slotRenderers"]["${rendererId}"] = function () use (&$componentCtx, &$html){`)
- sourceBuffer.addRaw('function defaultSlotRender($componentCtx) {')
+ sourceBuffer.addRaw('$defaultSlotRender = function ($componentCtx) {')
sourceBuffer.addRaw(' $html = "";')
each(aNode.children, function (aNodeChild) {
sourceBuffer.addRaw(aNodeCompiler.compile(aNodeChild, sourceBuffer, owner))
})
sourceBuffer.addRaw(' return $html;')
- sourceBuffer.addRaw('}')
+ sourceBuffer.addRaw('};')
sourceBuffer.addRaw('$isInserted = false;')
sourceBuffer.addRaw('$ctxSourceSlots = $componentCtx["sourceSlots"];')
@@ -6952,23 +6636,23 @@ const aNodeCompiler = {
sourceBuffer.addRaw('$slotName = ' + compileExprSource.expr(nameProp.expr) + ';')
sourceBuffer.addRaw('foreach ($ctxSourceSlots as $i => $slot) {')
- sourceBuffer.addRaw(' if ($slot[1] == $slotName) {')
+ sourceBuffer.addRaw(' if (count($slot) > 1 && $slot[1] == $slotName) {')
sourceBuffer.addRaw(' array_push($mySourceSlots, $slot[0]);')
sourceBuffer.addRaw(' $isInserted = true;')
sourceBuffer.addRaw(' }')
sourceBuffer.addRaw('}')
} else {
- sourceBuffer.addRaw('if (count($ctxSourceSlots) > 0 && array_key_exists(1, $ctxSourceSlots[0])) {')
+ sourceBuffer.addRaw('if (count($ctxSourceSlots) > 0 && !isset($ctxSourceSlots[0][1])) {')
sourceBuffer.addRaw(' array_push($mySourceSlots, $ctxSourceSlots[0][0]);')
sourceBuffer.addRaw(' $isInserted = true;')
sourceBuffer.addRaw('}')
}
sourceBuffer.addRaw('if (!$isInserted) { array_push($mySourceSlots, $defaultSlotRender); }')
- sourceBuffer.addRaw('$slotCtx = $isInserted ? componentCtx["owner"] : componentCtx;')
+ sourceBuffer.addRaw('$slotCtx = $isInserted ? $componentCtx["owner"] : $componentCtx;')
if (aNode.vars || aNode.directives.bind) {
- sourceBuffer.addRaw('$slotCtx = ["data" => extend([], $slotCtx["data"]), "proto" => $slotCtx["proto"], "owner" => $slotCtx["owner"]];'); // eslint-disable-line
+ sourceBuffer.addRaw('$slotCtx = ["data" => $slotCtx["data"], "proto" => $slotCtx["proto"], "owner" => $slotCtx["owner"]];'); // eslint-disable-line
if (aNode.directives.bind) {
sourceBuffer.addRaw('extend($slotCtx["data"], ' + compileExprSource.expr(aNode.directives.bind.value) + ');'); // eslint-disable-line
@@ -6976,7 +6660,7 @@ const aNodeCompiler = {
each(aNode.vars, function (varItem) {
sourceBuffer.addRaw(
- '$slotCtx.data["' + varItem.name + '"] = ' +
+ '$slotCtx["data"]["' + varItem.name + '"] = ' +
compileExprSource.expr(varItem.expr) +
';'
)
@@ -6984,11 +6668,11 @@ const aNodeCompiler = {
}
sourceBuffer.addRaw('foreach ($mySourceSlots as $renderIndex => $slot) {')
- sourceBuffer.addRaw(' $html += $slot($slotCtx);')
+ sourceBuffer.addRaw(' $html .= $slot($slotCtx);')
sourceBuffer.addRaw('}')
sourceBuffer.addRaw('};')
- sourceBuffer.addRaw(`call_user_func(componentCtx["slotRenderers"]["${rendererId}"]);`)
+ sourceBuffer.addRaw(`call_user_func($componentCtx["slotRenderers"]["${rendererId}"]);`)
},
/**
@@ -7039,23 +6723,23 @@ const aNodeCompiler = {
})
if (defaultSourceSlots.length) {
- sourceBuffer.addRaw('$sourceSlots.push([function (componentCtx) {')
- sourceBuffer.addRaw(' var html = "";')
+ sourceBuffer.addRaw('array_push($sourceSlots, [function ($componentCtx) {')
+ sourceBuffer.addRaw(' $html = "";')
defaultSourceSlots.forEach(function (child) {
aNodeCompiler.compile(child, sourceBuffer, owner)
})
- sourceBuffer.addRaw(' return html;')
+ sourceBuffer.addRaw(' return $html;')
sourceBuffer.addRaw('}]);')
}
for (const key in sourceSlotCodes) {
const sourceSlotCode = sourceSlotCodes[key]
- sourceBuffer.addRaw('$sourceSlots.push([function (componentCtx) {')
- sourceBuffer.addRaw(' var html = "";')
+ sourceBuffer.addRaw('array_push($sourceSlots, [function ($componentCtx) {')
+ sourceBuffer.addRaw(' $html = "";')
sourceBuffer.addRaw(sourceSlotCode.children.forEach(function (child) {
aNodeCompiler.compile(child, sourceBuffer, owner)
}))
- sourceBuffer.addRaw(' return html;')
+ sourceBuffer.addRaw(' return $html;')
sourceBuffer.addRaw('}, ' + compileExprSource.expr(sourceSlotCode.prop.expr) + ']);')
}
}
@@ -7143,7 +6827,7 @@ function compileComponentSource (sourceBuffer, ComponentClass, contextId) {
)
}
- // sourceBuffer.addRaw(`if (!array_key_exists("${cid}", San::$componentRenderers)) San::$componentRenderers["${cid}"] = $${cid};`)
+ // sourceBuffer.addRaw(`if (!isset(San::$componentRenderers["${cid}")) San::$componentRenderers["${cid}"] = $${cid};`)
sourceBuffer.addRaw(`function ${cid}($data, $noDataOutput = false, $parentCtx = [], $tagName = null, $sourceSlots = []) {`)
sourceBuffer.addRaw(`$${cid}Proto = ${genComponentProtoCode(component)}`)
@@ -7156,7 +6840,7 @@ function compileComponentSource (sourceBuffer, ComponentClass, contextId) {
sourceBuffer.addRaw('if ($data) {')
Object.keys(defaultData).forEach(function (key) {
const val = stringifier.any(defaultData[key])
- sourceBuffer.addRaw(`$componentCtx["data"]["${key}"] = array_key_exists("${key}", $componentCtx["data"]) ? $componentCtx["data"]["${key}"] : ${val};`)
+ sourceBuffer.addRaw(`$componentCtx["data"]["${key}"] = isset($componentCtx["data"]["${key}"]) ? $componentCtx["data"]["${key}"] : ${val};`)
})
sourceBuffer.addRaw('}')
@@ -7243,17 +6927,19 @@ function genComponentProtoCode (component) {
switch (typeof protoMember) {
case 'function':
// TODO function serialization
- code.push(`${protoMemberKey} => ${protoMember.toString()},`)
+ // code.push(`"${protoMemberKey}" => ${protoMember.toString()},`)
+ code.push(`"${protoMemberKey}" => function(){},`)
break
case 'object':
- code.push(protoMemberKey + ' => ')
+ code.push(`"${protoMemberKey}" => `)
if (protoMember instanceof Array) {
code.push('[')
protoMember.forEach(function (item) {
// TODO function serialization
- code.push(typeof item === 'function' ? item.toString() : '' + ',')
+ // code.push(typeof item === 'function' ? item.toString() : '' + ',')
+ code.push(typeof item === 'function' ? 'function(){}' : '' + ',')
})
code.push(']')
} else {
@@ -7262,7 +6948,8 @@ function genComponentProtoCode (component) {
const item = protoMember[itemKey]
// TODO function serialization
if (typeof item === 'function') {
- code.push(itemKey + ':' + item.toString() + ',')
+ code.push(`"${itemKey}" => function(){},`)
+ // code.push(`"${itemKey}" => ${item.toString()},`)
}
})
code.push(']')
@@ -7305,7 +6992,7 @@ function genComponentProtoCode (component) {
computedCode.push(key + ': ' +
computed.toString()
- .replace(/^\s*function\s*\(/, 'function (componentCtx')
+ .replace(/^\s*function\s*\(/, 'function ($componentCtx')
.replace(
/this.data.get\(([^)]+)\)/g,
function (match, exprLiteral) {
diff --git a/test/cases/elif-update-all-false/ssr.js b/test/cases/elif-update-all-false/ssr.js
index 207df308..6f69c4d4 100644
--- a/test/cases/elif-update-all-false/ssr.js
+++ b/test/cases/elif-update-all-false/ssr.js
@@ -156,8 +156,8 @@ function defaultStyleFilter (source) {
return source
}
-componentRenderers._id97 = componentRenderers._id97|| _id97;
-var _id97Proto = {
+componentRenderers._id1 = componentRenderers._id1|| _id1;
+var _id1Proto = {
filters: {
},
@@ -169,10 +169,10 @@ computedNames: [
],
tagName: "div"
};
-function _id97(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id1(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id97Proto,
+proto: _id1Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -210,5 +210,5 @@ html += "leeight";
html += "";
return html;
};
-return componentRenderers._id97(data, noDataOutput)
+return componentRenderers._id1(data, noDataOutput)
}
\ No newline at end of file
diff --git a/test/cases/elif-update-all-false/ssr.php b/test/cases/elif-update-all-false/ssr.php
new file mode 100644
index 00000000..5d3415a2
--- /dev/null
+++ b/test/cases/elif-update-all-false/ssr.php
@@ -0,0 +1,55 @@
+ [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id1Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+if ((isset($componentCtx["data"]["cond1"]) ? $componentCtx["data"]["cond1"] : null)) {
+$html .= "errorrik";
+
+}
+else if ((isset($componentCtx["data"]["cond2"]) ? $componentCtx["data"]["cond2"] : null)) {
+$html .= "leeight";
+
+}
+$html .= "
";
+return $html;
+};
+return call_user_func("_id1", $data, $noDataOutput);
+}; ?>
\ No newline at end of file
diff --git a/test/cases/s-html/ssr.js b/test/cases/s-html/ssr.js
index beb1dce1..0ae5a7be 100644
--- a/test/cases/s-html/ssr.js
+++ b/test/cases/s-html/ssr.js
@@ -156,8 +156,8 @@ function defaultStyleFilter (source) {
return source
}
-componentRenderers._id221 = componentRenderers._id221|| _id221;
-var _id221Proto = {
+componentRenderers._id1 = componentRenderers._id1|| _id1;
+var _id1Proto = {
filters: {
},
@@ -169,10 +169,10 @@ computedNames: [
],
tagName: "div"
};
-function _id221(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id1(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id221Proto,
+proto: _id1Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -204,5 +204,5 @@ html += componentCtx.data.html;
html += "";
return html;
};
-return componentRenderers._id221(data, noDataOutput)
+return componentRenderers._id1(data, noDataOutput)
}
\ No newline at end of file
diff --git a/test/cases/s-html/ssr.php b/test/cases/s-html/ssr.php
new file mode 100644
index 00000000..1b4d0642
--- /dev/null
+++ b/test/cases/s-html/ssr.php
@@ -0,0 +1,49 @@
+ [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id1Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$html .= "";
+$html .= (isset($componentCtx["data"]["html"]) ? $componentCtx["data"]["html"] : null);
+$html .= "
";
+return $html;
+};
+return call_user_func("_id1", $data, $noDataOutput);
+}; ?>
\ No newline at end of file
diff --git a/test/cases/scoped-slot-default-listened/ssr.js b/test/cases/scoped-slot-default-listened/ssr.js
index 5ea64138..f4a1c3e0 100644
--- a/test/cases/scoped-slot-default-listened/ssr.js
+++ b/test/cases/scoped-slot-default-listened/ssr.js
@@ -156,8 +156,8 @@ function defaultStyleFilter (source) {
return source
}
-componentRenderers._id228 = componentRenderers._id228|| _id228;
-var _id228Proto = {
+componentRenderers._id2 = componentRenderers._id2|| _id2;
+var _id2Proto = {
emailClick: function (email) {
clickInfo.email = email
clickInfo.outer = false
@@ -173,10 +173,10 @@ computedNames: [
],
tagName: "div"
};
-function _id228(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id2(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id228Proto,
+proto: _id2Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -203,7 +203,7 @@ html += ">";
if (!noDataOutput) {
html += "";
}
-componentCtx.slotRenderers._id229 = componentCtx.slotRenderers._id229 || function () {
+componentCtx.slotRenderers._id3 = componentCtx.slotRenderers._id3 || function () {
function $defaultSlotRender(componentCtx) {
var html = "";
html += "";
@@ -232,12 +232,12 @@ for (var $renderIndex = 0; $renderIndex < $mySourceSlots.length; $renderIndex++)
html += $mySourceSlots[$renderIndex]($slotCtx);
}
};
-componentCtx.slotRenderers._id229();
+componentCtx.slotRenderers._id3();
html += "";
return html;
};
-componentRenderers._id227 = componentRenderers._id227|| _id227;
-var _id227Proto = {
+componentRenderers._id1 = componentRenderers._id1|| _id1;
+var _id1Proto = {
emailClick: function (email) {
clickInfo.email = 'fail'
clickInfo.outer = true
@@ -253,10 +253,10 @@ computedNames: [
],
tagName: "div"
};
-function _id227(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id1(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id227Proto,
+proto: _id1Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -284,11 +284,11 @@ if (!noDataOutput) {
html += "";
}
var $sourceSlots = [];
-html += componentRenderers._id228(
+html += componentRenderers._id2(
{"data":componentCtx.data.man}, true, componentCtx, "x-man", $sourceSlots);
$sourceSlots = null;
html += "";
return html;
};
-return componentRenderers._id227(data, noDataOutput)
+return componentRenderers._id1(data, noDataOutput)
}
\ No newline at end of file
diff --git a/test/cases/scoped-slot-default-listened/ssr.php b/test/cases/scoped-slot-default-listened/ssr.php
new file mode 100644
index 00000000..11d7609c
--- /dev/null
+++ b/test/cases/scoped-slot-default-listened/ssr.php
@@ -0,0 +1,127 @@
+ function(){},
+"filters" => [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id2Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "
";
+}
+if (!isset($componentCtx["slotRenderers"]["_id3"])) $componentCtx["slotRenderers"]["_id3"] = function () use (&$componentCtx, &$html){
+$defaultSlotRender = function ($componentCtx) {
+ $html = "";
+$html .= "
";
+$html .= San::escapeHTML((isset($componentCtx["data"]["n"]) ? $componentCtx["data"]["n"] : null)) . "," . San::escapeHTML((isset($componentCtx["data"]["sex"]) ? $componentCtx["data"]["sex"] : null)) . "," . San::escapeHTML((isset($componentCtx["data"]["email"]) ? $componentCtx["data"]["email"] : null));
+$html .= "
";
+
+ return $html;
+};
+$isInserted = false;
+$ctxSourceSlots = $componentCtx["sourceSlots"];
+$mySourceSlots = [];
+$slotName = "test";
+foreach ($ctxSourceSlots as $i => $slot) {
+ if (count($slot) > 1 && $slot[1] == $slotName) {
+ array_push($mySourceSlots, $slot[0]);
+ $isInserted = true;
+ }
+}
+if (!$isInserted) { array_push($mySourceSlots, $defaultSlotRender); }
+$slotCtx = $isInserted ? $componentCtx["owner"] : $componentCtx;
+$slotCtx = ["data" => $slotCtx["data"], "proto" => $slotCtx["proto"], "owner" => $slotCtx["owner"]];
+$slotCtx["data"]["n"] = (isset($componentCtx["data"]["data"]["name"]) ? $componentCtx["data"]["data"]["name"] : null);
+$slotCtx["data"]["email"] = (isset($componentCtx["data"]["data"]["email"]) ? $componentCtx["data"]["data"]["email"] : null);
+$slotCtx["data"]["sex"] = (isset($componentCtx["data"]["data"]["sex"]) ? $componentCtx["data"]["data"]["sex"] : null)?"male":"female";
+foreach ($mySourceSlots as $renderIndex => $slot) {
+ $html .= $slot($slotCtx);
+}
+};
+call_user_func($componentCtx["slotRenderers"]["_id3"]);
+$html .= "
";
+return $html;
+};
+function _id1($data, $noDataOutput = false, $parentCtx = [], $tagName = null, $sourceSlots = []) {
+$_id1Proto = [
+"emailClick" => function(){},
+"filters" => [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id1Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$sourceSlots = [];
+$html .= call_user_func("_id2",
+["data" => (isset($componentCtx["data"]["man"]) ? $componentCtx["data"]["man"] : null)], true, $componentCtx, "x-man", $sourceSlots);
+$sourceSlots = null;
+$html .= "
";
+return $html;
+};
+return call_user_func("_id1", $data, $noDataOutput);
+}; ?>
\ No newline at end of file
diff --git a/test/cases/slot-desc-for-true/ssr.js b/test/cases/slot-desc-for-true/ssr.js
index d7a2fa59..39d6a854 100644
--- a/test/cases/slot-desc-for-true/ssr.js
+++ b/test/cases/slot-desc-for-true/ssr.js
@@ -156,8 +156,8 @@ function defaultStyleFilter (source) {
return source
}
-componentRenderers._id257 = componentRenderers._id257|| _id257;
-var _id257Proto = {
+componentRenderers._id2 = componentRenderers._id2|| _id2;
+var _id2Proto = {
toggle: function () {
const hidden = this.data.get('hidden')
this.data.set('hidden', !hidden)
@@ -173,10 +173,10 @@ computedNames: [
],
tagName: "div"
};
-function _id257(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id2(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id257Proto,
+proto: _id2Proto,
sourceSlots: sourceSlots,
data: data || {"repeat":[1,2]},
owner: parentCtx,
@@ -205,7 +205,7 @@ if (!noDataOutput) {
html += "";
}
html += "";
-componentCtx.slotRenderers._id258 = componentCtx.slotRenderers._id258 || function () {
+componentCtx.slotRenderers._id3 = componentCtx.slotRenderers._id3 || function () {
function $defaultSlotRender(componentCtx) {
var html = "";
return html;
@@ -226,15 +226,15 @@ for (var $renderIndex = 0; $renderIndex < $mySourceSlots.length; $renderIndex++)
html += $mySourceSlots[$renderIndex]($slotCtx);
}
};
-componentCtx.slotRenderers._id258();
+componentCtx.slotRenderers._id3();
html += "
";
if (!componentCtx.data.hidden) {
-var _id260 = componentCtx.data.repeat;
-if (_id260 instanceof Array) {
-for (var _id259 = 0; _id259 < _id260.length; _id259++) {
-componentCtx.data._id259=_id259;
-componentCtx.data.i= _id260[_id259];
-componentCtx.slotRenderers._id261 = componentCtx.slotRenderers._id261 || function () {
+var _id5 = componentCtx.data.repeat;
+if (_id5 instanceof Array) {
+for (var _id4 = 0; _id4 < _id5.length; _id4++) {
+componentCtx.data._id4=_id4;
+componentCtx.data.i= _id5[_id4];
+componentCtx.slotRenderers._id6 = componentCtx.slotRenderers._id6 || function () {
function $defaultSlotRender(componentCtx) {
var html = "";
return html;
@@ -252,15 +252,15 @@ for (var $renderIndex = 0; $renderIndex < $mySourceSlots.length; $renderIndex++)
html += $mySourceSlots[$renderIndex]($slotCtx);
}
};
-componentCtx.slotRenderers._id261();
+componentCtx.slotRenderers._id6();
}
-} else if (typeof _id260 === "object") {
-for (var _id259 in _id260) {
-if (_id260[_id259] != null) {
-componentCtx.data._id259=_id259;
-componentCtx.data.i= _id260[_id259];
-componentCtx.slotRenderers._id262 = componentCtx.slotRenderers._id262 || function () {
+} else if (typeof _id5 === "object") {
+for (var _id4 in _id5) {
+if (_id5[_id4] != null) {
+componentCtx.data._id4=_id4;
+componentCtx.data.i= _id5[_id4];
+componentCtx.slotRenderers._id7 = componentCtx.slotRenderers._id7 || function () {
function $defaultSlotRender(componentCtx) {
var html = "";
return html;
@@ -278,7 +278,7 @@ for (var $renderIndex = 0; $renderIndex < $mySourceSlots.length; $renderIndex++)
html += $mySourceSlots[$renderIndex]($slotCtx);
}
};
-componentCtx.slotRenderers._id262();
+componentCtx.slotRenderers._id7();
}
}
@@ -288,8 +288,8 @@ componentCtx.slotRenderers._id262();
html += "";
return html;
};
-componentRenderers._id256 = componentRenderers._id256|| _id256;
-var _id256Proto = {
+componentRenderers._id1 = componentRenderers._id1|| _id1;
+var _id1Proto = {
filters: {
},
@@ -301,10 +301,10 @@ computedNames: [
],
tagName: "div"
};
-function _id256(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id1(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id256Proto,
+proto: _id1Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -347,11 +347,11 @@ html += "";
return html;
}, "title"]);
-html += componentRenderers._id257(
+html += componentRenderers._id2(
{"hidden":componentCtx.data.folderHidden}, true, componentCtx, "x-folder", $sourceSlots);
$sourceSlots = null;
html += "";
return html;
};
-return componentRenderers._id256(data, noDataOutput)
+return componentRenderers._id1(data, noDataOutput)
}
\ No newline at end of file
diff --git a/test/cases/slot-desc-for-true/ssr.php b/test/cases/slot-desc-for-true/ssr.php
new file mode 100644
index 00000000..974e8279
--- /dev/null
+++ b/test/cases/slot-desc-for-true/ssr.php
@@ -0,0 +1,166 @@
+ function(){},
+"filters" => [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id2Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : ["repeat" => [1,2]],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+$componentCtx["data"]["repeat"] = isset($componentCtx["data"]["repeat"]) ? $componentCtx["data"]["repeat"] : [1,2];
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$html .= "
";
+if (!isset($componentCtx["slotRenderers"]["_id3"])) $componentCtx["slotRenderers"]["_id3"] = function () use (&$componentCtx, &$html){
+$defaultSlotRender = function ($componentCtx) {
+ $html = "";
+ return $html;
+};
+$isInserted = false;
+$ctxSourceSlots = $componentCtx["sourceSlots"];
+$mySourceSlots = [];
+$slotName = "title";
+foreach ($ctxSourceSlots as $i => $slot) {
+ if (count($slot) > 1 && $slot[1] == $slotName) {
+ array_push($mySourceSlots, $slot[0]);
+ $isInserted = true;
+ }
+}
+if (!$isInserted) { array_push($mySourceSlots, $defaultSlotRender); }
+$slotCtx = $isInserted ? $componentCtx["owner"] : $componentCtx;
+foreach ($mySourceSlots as $renderIndex => $slot) {
+ $html .= $slot($slotCtx);
+}
+};
+call_user_func($componentCtx["slotRenderers"]["_id3"]);
+$html .= "
";
+if (!(isset($componentCtx["data"]["hidden"]) ? $componentCtx["data"]["hidden"] : null)) {
+$_id5 = (isset($componentCtx["data"]["repeat"]) ? $componentCtx["data"]["repeat"] : null);
+if (is_array($_id5)) {
+foreach ($_id5 as $_id4 => $value) {
+$componentCtx["data"]["_id4"] = $_id4;
+$componentCtx["data"]["i"] = $value;
+if (!isset($componentCtx["slotRenderers"]["_id6"])) $componentCtx["slotRenderers"]["_id6"] = function () use (&$componentCtx, &$html){
+$defaultSlotRender = function ($componentCtx) {
+ $html = "";
+ return $html;
+};
+$isInserted = false;
+$ctxSourceSlots = $componentCtx["sourceSlots"];
+$mySourceSlots = [];
+if (count($ctxSourceSlots) > 0 && !isset($ctxSourceSlots[0][1])) {
+ array_push($mySourceSlots, $ctxSourceSlots[0][0]);
+ $isInserted = true;
+}
+if (!$isInserted) { array_push($mySourceSlots, $defaultSlotRender); }
+$slotCtx = $isInserted ? $componentCtx["owner"] : $componentCtx;
+foreach ($mySourceSlots as $renderIndex => $slot) {
+ $html .= $slot($slotCtx);
+}
+};
+call_user_func($componentCtx["slotRenderers"]["_id6"]);
+
+}
+}
+
+}
+$html .= "
";
+return $html;
+};
+function _id1($data, $noDataOutput = false, $parentCtx = [], $tagName = null, $sourceSlots = []) {
+$_id1Proto = [
+"filters" => [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id1Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$sourceSlots = [];
+array_push($sourceSlots, [function ($componentCtx) {
+ $html = "";
+$html .= "
";
+$html .= San::escapeHTML((isset($componentCtx["data"]["desc"]) ? $componentCtx["data"]["desc"] : null));
+$html .= "
";
+ return $html;
+}]);
+array_push($sourceSlots, [function ($componentCtx) {
+ $html = "";
+$html .= "
";
+$html .= San::escapeHTML((isset($componentCtx["data"]["name"]) ? $componentCtx["data"]["name"] : null));
+$html .= "";
+
+ return $html;
+}, "title"]);
+$html .= call_user_func("_id2",
+["hidden" => (isset($componentCtx["data"]["folderHidden"]) ? $componentCtx["data"]["folderHidden"] : null)], true, $componentCtx, "x-folder", $sourceSlots);
+$sourceSlots = null;
+$html .= "
";
+return $html;
+};
+return call_user_func("_id1", $data, $noDataOutput);
+}; ?>
\ No newline at end of file
diff --git a/test/cases/slot-desc-if-true/ssr.js b/test/cases/slot-desc-if-true/ssr.js
index ad61118a..db9a4038 100644
--- a/test/cases/slot-desc-if-true/ssr.js
+++ b/test/cases/slot-desc-if-true/ssr.js
@@ -156,8 +156,8 @@ function defaultStyleFilter (source) {
return source
}
-componentRenderers._id265 = componentRenderers._id265|| _id265;
-var _id265Proto = {
+componentRenderers._id2 = componentRenderers._id2|| _id2;
+var _id2Proto = {
toggle: function () {
const hidden = this.data.get('hidden')
this.data.set('hidden', !hidden)
@@ -173,10 +173,10 @@ computedNames: [
],
tagName: "div"
};
-function _id265(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id2(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id265Proto,
+proto: _id2Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -204,7 +204,7 @@ if (!noDataOutput) {
html += "";
}
html += "";
-componentCtx.slotRenderers._id266 = componentCtx.slotRenderers._id266 || function () {
+componentCtx.slotRenderers._id3 = componentCtx.slotRenderers._id3 || function () {
function $defaultSlotRender(componentCtx) {
var html = "";
return html;
@@ -225,10 +225,10 @@ for (var $renderIndex = 0; $renderIndex < $mySourceSlots.length; $renderIndex++)
html += $mySourceSlots[$renderIndex]($slotCtx);
}
};
-componentCtx.slotRenderers._id266();
+componentCtx.slotRenderers._id3();
html += "
";
if (!componentCtx.data.hidden) {
-componentCtx.slotRenderers._id267 = componentCtx.slotRenderers._id267 || function () {
+componentCtx.slotRenderers._id4 = componentCtx.slotRenderers._id4 || function () {
function $defaultSlotRender(componentCtx) {
var html = "";
return html;
@@ -246,14 +246,14 @@ for (var $renderIndex = 0; $renderIndex < $mySourceSlots.length; $renderIndex++)
html += $mySourceSlots[$renderIndex]($slotCtx);
}
};
-componentCtx.slotRenderers._id267();
+componentCtx.slotRenderers._id4();
}
html += "";
return html;
};
-componentRenderers._id264 = componentRenderers._id264|| _id264;
-var _id264Proto = {
+componentRenderers._id1 = componentRenderers._id1|| _id1;
+var _id1Proto = {
filters: {
},
@@ -265,10 +265,10 @@ computedNames: [
],
tagName: "div"
};
-function _id264(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id1(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id264Proto,
+proto: _id1Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -311,11 +311,11 @@ html += "";
return html;
}, "title"]);
-html += componentRenderers._id265(
+html += componentRenderers._id2(
{"hidden":componentCtx.data.folderHidden}, true, componentCtx, "x-folder", $sourceSlots);
$sourceSlots = null;
html += "";
return html;
};
-return componentRenderers._id264(data, noDataOutput)
+return componentRenderers._id1(data, noDataOutput)
}
\ No newline at end of file
diff --git a/test/cases/slot-desc-if-true/ssr.php b/test/cases/slot-desc-if-true/ssr.php
new file mode 100644
index 00000000..eab00f99
--- /dev/null
+++ b/test/cases/slot-desc-if-true/ssr.php
@@ -0,0 +1,157 @@
+ function(){},
+"filters" => [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id2Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$html .= "
";
+if (!array_key_exists("_id3", $componentCtx["slotRenderers"])) $componentCtx["slotRenderers"]["_id3"] = function () use ($componentCtx, &$html){
+$defaultSlotRender = function ($componentCtx) {
+ $html = "";
+ return $html;
+};
+$isInserted = false;
+$ctxSourceSlots = $componentCtx["sourceSlots"];
+$mySourceSlots = [];
+$slotName = "title";
+foreach ($ctxSourceSlots as $i => $slot) {
+ if (count($slot) > 1 && $slot[1] == $slotName) {
+ array_push($mySourceSlots, $slot[0]);
+ $isInserted = true;
+ }
+}
+if (!$isInserted) { array_push($mySourceSlots, $defaultSlotRender); }
+$slotCtx = $isInserted ? $componentCtx["owner"] : $componentCtx;
+foreach ($mySourceSlots as $renderIndex => $slot) {
+ $html .= $slot($slotCtx);
+}
+};
+call_user_func($componentCtx["slotRenderers"]["_id3"]);
+$html .= "
";
+if (!(array_key_exists("hidden", $componentCtx["data"]) ? $componentCtx["data"]["hidden"] : null)) {
+if (!array_key_exists("_id4", $componentCtx["slotRenderers"])) $componentCtx["slotRenderers"]["_id4"] = function () use ($componentCtx, &$html){
+$defaultSlotRender = function ($componentCtx) {
+ $html = "";
+ return $html;
+};
+$isInserted = false;
+$ctxSourceSlots = $componentCtx["sourceSlots"];
+$mySourceSlots = [];
+if (count($ctxSourceSlots) > 0 && !array_key_exists(1, $ctxSourceSlots[0])) {
+ array_push($mySourceSlots, $ctxSourceSlots[0][0]);
+ $isInserted = true;
+}
+if (!$isInserted) { array_push($mySourceSlots, $defaultSlotRender); }
+$slotCtx = $isInserted ? $componentCtx["owner"] : $componentCtx;
+foreach ($mySourceSlots as $renderIndex => $slot) {
+ $html .= $slot($slotCtx);
+}
+};
+call_user_func($componentCtx["slotRenderers"]["_id4"]);
+
+}
+$html .= "";
+return $html;
+};
+function _id1($data, $noDataOutput = false, $parentCtx = [], $tagName = null, $sourceSlots = []) {
+$_id1Proto = [
+"filters" => [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id1Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$sourceSlots = [];
+array_push($sourceSlots, [function ($componentCtx) {
+ $html = "";
+$html .= "
";
+$html .= San::escapeHTML((array_key_exists("desc", $componentCtx["data"]) ? $componentCtx["data"]["desc"] : null));
+$html .= "
";
+ return $html;
+}]);
+array_push($sourceSlots, [function ($componentCtx) {
+ $html = "";
+$html .= "
";
+$html .= San::escapeHTML((array_key_exists("name", $componentCtx["data"]) ? $componentCtx["data"]["name"] : null));
+$html .= "";
+
+ return $html;
+}, "title"]);
+$html .= call_user_func("_id2",
+["hidden" => (array_key_exists("folderHidden", $componentCtx["data"]) ? $componentCtx["data"]["folderHidden"] : null)], true, $componentCtx, "x-folder", $sourceSlots);
+$sourceSlots = null;
+$html .= "
";
+return $html;
+};
+return call_user_func("_id1", $data, $noDataOutput);
+}; ?>
\ No newline at end of file
diff --git a/test/cases/slot-insert-ele-for/ssr.js b/test/cases/slot-insert-ele-for/ssr.js
index 238236c7..bf85251f 100644
--- a/test/cases/slot-insert-ele-for/ssr.js
+++ b/test/cases/slot-insert-ele-for/ssr.js
@@ -156,8 +156,8 @@ function defaultStyleFilter (source) {
return source
}
-componentRenderers._id270 = componentRenderers._id270|| _id270;
-var _id270Proto = {
+componentRenderers._id2 = componentRenderers._id2|| _id2;
+var _id2Proto = {
toggle: function () {
const hidden = this.data.get('hidden')
this.data.set('hidden', !hidden)
@@ -173,10 +173,10 @@ computedNames: [
],
tagName: "div"
};
-function _id270(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id2(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id270Proto,
+proto: _id2Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -204,7 +204,7 @@ if (!noDataOutput) {
html += "";
}
html += "";
-componentCtx.slotRenderers._id271 = componentCtx.slotRenderers._id271 || function () {
+componentCtx.slotRenderers._id3 = componentCtx.slotRenderers._id3 || function () {
function $defaultSlotRender(componentCtx) {
var html = "";
return html;
@@ -225,9 +225,9 @@ for (var $renderIndex = 0; $renderIndex < $mySourceSlots.length; $renderIndex++)
html += $mySourceSlots[$renderIndex]($slotCtx);
}
};
-componentCtx.slotRenderers._id271();
+componentCtx.slotRenderers._id3();
html += "
";
-componentCtx.slotRenderers._id272 = componentCtx.slotRenderers._id272 || function () {
+componentCtx.slotRenderers._id4 = componentCtx.slotRenderers._id4 || function () {
function $defaultSlotRender(componentCtx) {
var html = "";
return html;
@@ -248,12 +248,12 @@ for (var $renderIndex = 0; $renderIndex < $mySourceSlots.length; $renderIndex++)
html += $mySourceSlots[$renderIndex]($slotCtx);
}
};
-componentCtx.slotRenderers._id272();
+componentCtx.slotRenderers._id4();
html += "";
return html;
};
-componentRenderers._id269 = componentRenderers._id269|| _id269;
-var _id269Proto = {
+componentRenderers._id1 = componentRenderers._id1|| _id1;
+var _id1Proto = {
filters: {
},
@@ -265,10 +265,10 @@ computedNames: [
],
tagName: "div"
};
-function _id269(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id1(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id269Proto,
+proto: _id1Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -306,11 +306,11 @@ html += "";
}, "title"]);
$sourceSlots.push([function (componentCtx) {
var html = "";
-var _id273 = componentCtx.data.persons;
-if (_id273 instanceof Array) {
-for (var i = 0; i < _id273.length; i++) {
+var _id5 = componentCtx.data.persons;
+if (_id5 instanceof Array) {
+for (var i = 0; i < _id5.length; i++) {
componentCtx.data.i=i;
-componentCtx.data.p= _id273[i];
+componentCtx.data.p= _id5[i];
html += " ";
html += escapeHTML(componentCtx.data.p.name);
html += "
";
@@ -318,11 +318,11 @@ html += escapeHTML(componentCtx.data.p.email);
html += "
";
}
-} else if (typeof _id273 === "object") {
-for (var i in _id273) {
-if (_id273[i] != null) {
+} else if (typeof _id5 === "object") {
+for (var i in _id5) {
+if (_id5[i] != null) {
componentCtx.data.i=i;
-componentCtx.data.p= _id273[i];
+componentCtx.data.p= _id5[i];
html += " ";
html += escapeHTML(componentCtx.data.p.name);
html += "
";
@@ -335,11 +335,11 @@ html += "
";
return html;
}, "content"]);
-html += componentRenderers._id270(
+html += componentRenderers._id2(
{"hidden":componentCtx.data.folderHidden}, true, componentCtx, "x-folder", $sourceSlots);
$sourceSlots = null;
html += "";
return html;
};
-return componentRenderers._id269(data, noDataOutput)
+return componentRenderers._id1(data, noDataOutput)
}
\ No newline at end of file
diff --git a/test/cases/slot-insert-ele-for/ssr.php b/test/cases/slot-insert-ele-for/ssr.php
new file mode 100644
index 00000000..39426211
--- /dev/null
+++ b/test/cases/slot-insert-ele-for/ssr.php
@@ -0,0 +1,168 @@
+ function(){},
+"filters" => [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id2Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$html .= "
";
+if (!isset($componentCtx["slotRenderers"]["_id3"])) $componentCtx["slotRenderers"]["_id3"] = function () use (&$componentCtx, &$html){
+$defaultSlotRender = function ($componentCtx) {
+ $html = "";
+ return $html;
+};
+$isInserted = false;
+$ctxSourceSlots = $componentCtx["sourceSlots"];
+$mySourceSlots = [];
+$slotName = "title";
+foreach ($ctxSourceSlots as $i => $slot) {
+ if (count($slot) > 1 && $slot[1] == $slotName) {
+ array_push($mySourceSlots, $slot[0]);
+ $isInserted = true;
+ }
+}
+if (!$isInserted) { array_push($mySourceSlots, $defaultSlotRender); }
+$slotCtx = $isInserted ? $componentCtx["owner"] : $componentCtx;
+foreach ($mySourceSlots as $renderIndex => $slot) {
+ $html .= $slot($slotCtx);
+}
+};
+call_user_func($componentCtx["slotRenderers"]["_id3"]);
+$html .= "
";
+if (!isset($componentCtx["slotRenderers"]["_id4"])) $componentCtx["slotRenderers"]["_id4"] = function () use (&$componentCtx, &$html){
+$defaultSlotRender = function ($componentCtx) {
+ $html = "";
+ return $html;
+};
+$isInserted = false;
+$ctxSourceSlots = $componentCtx["sourceSlots"];
+$mySourceSlots = [];
+$slotName = "content";
+foreach ($ctxSourceSlots as $i => $slot) {
+ if (count($slot) > 1 && $slot[1] == $slotName) {
+ array_push($mySourceSlots, $slot[0]);
+ $isInserted = true;
+ }
+}
+if (!$isInserted) { array_push($mySourceSlots, $defaultSlotRender); }
+$slotCtx = $isInserted ? $componentCtx["owner"] : $componentCtx;
+foreach ($mySourceSlots as $renderIndex => $slot) {
+ $html .= $slot($slotCtx);
+}
+};
+call_user_func($componentCtx["slotRenderers"]["_id4"]);
+$html .= "";
+return $html;
+};
+function _id1($data, $noDataOutput = false, $parentCtx = [], $tagName = null, $sourceSlots = []) {
+$_id1Proto = [
+"filters" => [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id1Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$sourceSlots = [];
+array_push($sourceSlots, [function ($componentCtx) {
+ $html = "";
+$html .= "
";
+$html .= San::escapeHTML((isset($componentCtx["data"]["name"]) ? $componentCtx["data"]["name"] : null));
+$html .= "";
+
+ return $html;
+}, "title"]);
+array_push($sourceSlots, [function ($componentCtx) {
+ $html = "";
+$_id5 = (isset($componentCtx["data"]["persons"]) ? $componentCtx["data"]["persons"] : null);
+if (is_array($_id5)) {
+foreach ($_id5 as $i => $value) {
+$componentCtx["data"]["i"] = $i;
+$componentCtx["data"]["p"] = $value;
+$html .= "
";
+$html .= San::escapeHTML((isset($componentCtx["data"]["p"]["name"]) ? $componentCtx["data"]["p"]["name"] : null));
+$html .= "
";
+$html .= San::escapeHTML((isset($componentCtx["data"]["p"]["email"]) ? $componentCtx["data"]["p"]["email"] : null));
+$html .= "
";
+
+}
+}
+
+ return $html;
+}, "content"]);
+$html .= call_user_func("_id2",
+["hidden" => (isset($componentCtx["data"]["folderHidden"]) ? $componentCtx["data"]["folderHidden"] : null)], true, $componentCtx, "x-folder", $sourceSlots);
+$sourceSlots = null;
+$html .= "
";
+return $html;
+};
+return call_user_func("_id1", $data, $noDataOutput);
+}; ?>
\ No newline at end of file
diff --git a/test/cases/slot-insert-ele-if/ssr.js b/test/cases/slot-insert-ele-if/ssr.js
index 1d4bfc80..362a4e83 100644
--- a/test/cases/slot-insert-ele-if/ssr.js
+++ b/test/cases/slot-insert-ele-if/ssr.js
@@ -156,8 +156,8 @@ function defaultStyleFilter (source) {
return source
}
-componentRenderers._id276 = componentRenderers._id276|| _id276;
-var _id276Proto = {
+componentRenderers._id2 = componentRenderers._id2|| _id2;
+var _id2Proto = {
toggle: function () {
const hidden = this.data.get('hidden')
this.data.set('hidden', !hidden)
@@ -173,10 +173,10 @@ computedNames: [
],
tagName: "div"
};
-function _id276(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id2(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id276Proto,
+proto: _id2Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -204,7 +204,7 @@ if (!noDataOutput) {
html += "";
}
html += "";
-componentCtx.slotRenderers._id277 = componentCtx.slotRenderers._id277 || function () {
+componentCtx.slotRenderers._id3 = componentCtx.slotRenderers._id3 || function () {
function $defaultSlotRender(componentCtx) {
var html = "";
return html;
@@ -225,9 +225,9 @@ for (var $renderIndex = 0; $renderIndex < $mySourceSlots.length; $renderIndex++)
html += $mySourceSlots[$renderIndex]($slotCtx);
}
};
-componentCtx.slotRenderers._id277();
+componentCtx.slotRenderers._id3();
html += "
";
-componentCtx.slotRenderers._id278 = componentCtx.slotRenderers._id278 || function () {
+componentCtx.slotRenderers._id4 = componentCtx.slotRenderers._id4 || function () {
function $defaultSlotRender(componentCtx) {
var html = "";
return html;
@@ -248,12 +248,12 @@ for (var $renderIndex = 0; $renderIndex < $mySourceSlots.length; $renderIndex++)
html += $mySourceSlots[$renderIndex]($slotCtx);
}
};
-componentCtx.slotRenderers._id278();
+componentCtx.slotRenderers._id4();
html += "";
return html;
};
-componentRenderers._id275 = componentRenderers._id275|| _id275;
-var _id275Proto = {
+componentRenderers._id1 = componentRenderers._id1|| _id1;
+var _id1Proto = {
filters: {
},
@@ -265,10 +265,10 @@ computedNames: [
],
tagName: "div"
};
-function _id275(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id1(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id275Proto,
+proto: _id1Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -333,11 +333,11 @@ html += "";
return html;
}, "content"]);
-html += componentRenderers._id276(
+html += componentRenderers._id2(
{"hidden":componentCtx.data.folderHidden}, true, componentCtx, "x-folder", $sourceSlots);
$sourceSlots = null;
html += "";
return html;
};
-return componentRenderers._id275(data, noDataOutput)
+return componentRenderers._id1(data, noDataOutput)
}
\ No newline at end of file
diff --git a/test/cases/slot-insert-ele-if/ssr.php b/test/cases/slot-insert-ele-if/ssr.php
new file mode 100644
index 00000000..47518d03
--- /dev/null
+++ b/test/cases/slot-insert-ele-if/ssr.php
@@ -0,0 +1,179 @@
+ function(){},
+"filters" => [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id2Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$html .= "
";
+if (!array_key_exists("_id3", $componentCtx["slotRenderers"])) $componentCtx["slotRenderers"]["_id3"] = function () use ($componentCtx, &$html){
+$defaultSlotRender = function ($componentCtx) {
+ $html = "";
+ return $html;
+};
+$isInserted = false;
+$ctxSourceSlots = $componentCtx["sourceSlots"];
+$mySourceSlots = [];
+$slotName = "title";
+foreach ($ctxSourceSlots as $i => $slot) {
+ if ($slot[1] == $slotName) {
+ array_push($mySourceSlots, $slot[0]);
+ $isInserted = true;
+ }
+}
+if (!$isInserted) { array_push($mySourceSlots, $defaultSlotRender); }
+$slotCtx = $isInserted ? $componentCtx["owner"] : $componentCtx;
+foreach ($mySourceSlots as $renderIndex => $slot) {
+ $html .= $slot($slotCtx);
+}
+};
+call_user_func($componentCtx["slotRenderers"]["_id3"]);
+$html .= "
";
+if (!array_key_exists("_id4", $componentCtx["slotRenderers"])) $componentCtx["slotRenderers"]["_id4"] = function () use ($componentCtx, &$html){
+$defaultSlotRender = function ($componentCtx) {
+ $html = "";
+ return $html;
+};
+$isInserted = false;
+$ctxSourceSlots = $componentCtx["sourceSlots"];
+$mySourceSlots = [];
+$slotName = "content";
+foreach ($ctxSourceSlots as $i => $slot) {
+ if ($slot[1] == $slotName) {
+ array_push($mySourceSlots, $slot[0]);
+ $isInserted = true;
+ }
+}
+if (!$isInserted) { array_push($mySourceSlots, $defaultSlotRender); }
+$slotCtx = $isInserted ? $componentCtx["owner"] : $componentCtx;
+foreach ($mySourceSlots as $renderIndex => $slot) {
+ $html .= $slot($slotCtx);
+}
+};
+call_user_func($componentCtx["slotRenderers"]["_id4"]);
+$html .= "";
+return $html;
+};
+function _id1($data, $noDataOutput = false, $parentCtx = [], $tagName = null, $sourceSlots = []) {
+$_id1Proto = [
+"filters" => [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id1Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$sourceSlots = [];
+array_push($sourceSlots, [function ($componentCtx) {
+ $html = "";
+$html .= "
";
+$html .= San::escapeHTML((array_key_exists("name", $componentCtx["data"]) ? $componentCtx["data"]["name"] : null));
+$html .= "";
+
+ return $html;
+}, "title"]);
+array_push($sourceSlots, [function ($componentCtx) {
+ $html = "";
+if ((array_key_exists("num", $componentCtx["data"]) ? $componentCtx["data"]["num"] : null)>10000) {
+$html .= "
biiig
";
+$html .= San::escapeHTML((array_key_exists("num", $componentCtx["data"]) ? $componentCtx["data"]["num"] : null));
+$html .= "
";
+
+}
+else if ((array_key_exists("num", $componentCtx["data"]) ? $componentCtx["data"]["num"] : null)>1000) {
+$html .= "
biig
";
+$html .= San::escapeHTML((array_key_exists("num", $componentCtx["data"]) ? $componentCtx["data"]["num"] : null));
+$html .= "
";
+
+}
+else if ((array_key_exists("num", $componentCtx["data"]) ? $componentCtx["data"]["num"] : null)>100) {
+$html .= "
big
";
+$html .= San::escapeHTML((array_key_exists("num", $componentCtx["data"]) ? $componentCtx["data"]["num"] : null));
+$html .= "
";
+
+}
+else {
+$html .= "
small
";
+$html .= San::escapeHTML((array_key_exists("num", $componentCtx["data"]) ? $componentCtx["data"]["num"] : null));
+$html .= "
";
+
+}
+
+ return $html;
+}, "content"]);
+$html .= call_user_func("_id2",
+["hidden" => (array_key_exists("folderHidden", $componentCtx["data"]) ? $componentCtx["data"]["folderHidden"] : null)], true, $componentCtx, "x-folder", $sourceSlots);
+$sourceSlots = null;
+$html .= "
";
+return $html;
+};
+return call_user_func("_id1", $data, $noDataOutput);
+}; ?>
\ No newline at end of file
diff --git a/test/cases/slot-named-content-default/ssr.js b/test/cases/slot-named-content-default/ssr.js
index 07dbe646..66454dc4 100644
--- a/test/cases/slot-named-content-default/ssr.js
+++ b/test/cases/slot-named-content-default/ssr.js
@@ -156,8 +156,8 @@ function defaultStyleFilter (source) {
return source
}
-componentRenderers._id281 = componentRenderers._id281|| _id281;
-var _id281Proto = {
+componentRenderers._id2 = componentRenderers._id2|| _id2;
+var _id2Proto = {
filters: {
},
@@ -169,10 +169,10 @@ computedNames: [
],
tagName: "div"
};
-function _id281(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id2(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id281Proto,
+proto: _id2Proto,
sourceSlots: sourceSlots,
data: data || {"title":"5","text":"five"},
owner: parentCtx,
@@ -202,7 +202,7 @@ if (!noDataOutput) {
html += "";
}
html += "";
-componentCtx.slotRenderers._id282 = componentCtx.slotRenderers._id282 || function () {
+componentCtx.slotRenderers._id3 = componentCtx.slotRenderers._id3 || function () {
function $defaultSlotRender(componentCtx) {
var html = "";
html += "
";
-componentCtx.slotRenderers._id283 = componentCtx.slotRenderers._id283 || function () {
+componentCtx.slotRenderers._id4 = componentCtx.slotRenderers._id4 || function () {
function $defaultSlotRender(componentCtx) {
var html = "";
html += "
";
return html;
};
-componentRenderers._id280 = componentRenderers._id280|| _id280;
-var _id280Proto = {
+componentRenderers._id1 = componentRenderers._id1|| _id1;
+var _id1Proto = {
filters: {
},
@@ -276,10 +276,10 @@ computedNames: [
],
tagName: "div"
};
-function _id280(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id1(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id280Proto,
+proto: _id1Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -307,12 +307,12 @@ if (!noDataOutput) {
html += "";
}
var $sourceSlots = [];
-html += componentRenderers._id281(
+html += componentRenderers._id2(
{"title":componentCtx.data.tTitle,
"text":componentCtx.data.tText}, true, componentCtx, "ui-tab", $sourceSlots);
$sourceSlots = null;
html += "
";
return html;
};
-return componentRenderers._id280(data, noDataOutput)
+return componentRenderers._id1(data, noDataOutput)
}
\ No newline at end of file
diff --git a/test/cases/slot-named-content-default/ssr.php b/test/cases/slot-named-content-default/ssr.php
new file mode 100644
index 00000000..d50e45a1
--- /dev/null
+++ b/test/cases/slot-named-content-default/ssr.php
@@ -0,0 +1,157 @@
+ [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id2Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : ["title" => "5","text" => "five"],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+$componentCtx["data"]["title"] = isset($componentCtx["data"]["title"]) ? $componentCtx["data"]["title"] : "5";
+$componentCtx["data"]["text"] = isset($componentCtx["data"]["text"]) ? $componentCtx["data"]["text"] : "five";
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$html .= "
";
+if (!isset($componentCtx["slotRenderers"]["_id3"])) $componentCtx["slotRenderers"]["_id3"] = function () use (&$componentCtx, &$html){
+$defaultSlotRender = function ($componentCtx) {
+ $html = "";
+$html .= "
$slot) {
+ if (count($slot) > 1 && $slot[1] == $slotName) {
+ array_push($mySourceSlots, $slot[0]);
+ $isInserted = true;
+ }
+}
+if (!$isInserted) { array_push($mySourceSlots, $defaultSlotRender); }
+$slotCtx = $isInserted ? $componentCtx["owner"] : $componentCtx;
+foreach ($mySourceSlots as $renderIndex => $slot) {
+ $html .= $slot($slotCtx);
+}
+};
+call_user_func($componentCtx["slotRenderers"]["_id3"]);
+$html .= "
";
+if (!isset($componentCtx["slotRenderers"]["_id4"])) $componentCtx["slotRenderers"]["_id4"] = function () use (&$componentCtx, &$html){
+$defaultSlotRender = function ($componentCtx) {
+ $html = "";
+$html .= "
0 && !isset($ctxSourceSlots[0][1])) {
+ array_push($mySourceSlots, $ctxSourceSlots[0][0]);
+ $isInserted = true;
+}
+if (!$isInserted) { array_push($mySourceSlots, $defaultSlotRender); }
+$slotCtx = $isInserted ? $componentCtx["owner"] : $componentCtx;
+foreach ($mySourceSlots as $renderIndex => $slot) {
+ $html .= $slot($slotCtx);
+}
+};
+call_user_func($componentCtx["slotRenderers"]["_id4"]);
+$html .= "
";
+return $html;
+};
+function _id1($data, $noDataOutput = false, $parentCtx = [], $tagName = null, $sourceSlots = []) {
+$_id1Proto = [
+"filters" => [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id1Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$sourceSlots = [];
+$html .= call_user_func("_id2",
+["title" => (isset($componentCtx["data"]["tTitle"]) ? $componentCtx["data"]["tTitle"] : null),
+"text" => (isset($componentCtx["data"]["tText"]) ? $componentCtx["data"]["tText"] : null)], true, $componentCtx, "ui-tab", $sourceSlots);
+$sourceSlots = null;
+$html .= "
";
+return $html;
+};
+return call_user_func("_id1", $data, $noDataOutput);
+}; ?>
\ No newline at end of file
diff --git a/test/cases/slot-shake-desc-ele-name/ssr.js b/test/cases/slot-shake-desc-ele-name/ssr.js
index d6ba3198..1369d6a9 100644
--- a/test/cases/slot-shake-desc-ele-name/ssr.js
+++ b/test/cases/slot-shake-desc-ele-name/ssr.js
@@ -156,8 +156,8 @@ function defaultStyleFilter (source) {
return source
}
-componentRenderers._id286 = componentRenderers._id286|| _id286;
-var _id286Proto = {
+componentRenderers._id2 = componentRenderers._id2|| _id2;
+var _id2Proto = {
filters: {
},
@@ -169,10 +169,10 @@ computedNames: [
],
tagName: "div"
};
-function _id286(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id2(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id286Proto,
+proto: _id2Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -200,21 +200,21 @@ if (!noDataOutput) {
html += "";
}
html += " ";
-var _id288 = componentCtx.data.columns;
-if (_id288 instanceof Array) {
-for (var _id287 = 0; _id287 < _id288.length; _id287++) {
-componentCtx.data._id287=_id287;
-componentCtx.data.col= _id288[_id287];
+var _id4 = componentCtx.data.columns;
+if (_id4 instanceof Array) {
+for (var _id3 = 0; _id3 < _id4.length; _id3++) {
+componentCtx.data._id3=_id3;
+componentCtx.data.col= _id4[_id3];
html += "";
html += escapeHTML(componentCtx.data.col.label);
html += "
";
}
-} else if (typeof _id288 === "object") {
-for (var _id287 in _id288) {
-if (_id288[_id287] != null) {
-componentCtx.data._id287=_id287;
-componentCtx.data.col= _id288[_id287];
+} else if (typeof _id4 === "object") {
+for (var _id3 in _id4) {
+if (_id4[_id3] != null) {
+componentCtx.data._id3=_id3;
+componentCtx.data.col= _id4[_id3];
html += "";
html += escapeHTML(componentCtx.data.col.label);
html += "
";
@@ -223,19 +223,19 @@ html += "";
}
}
html += " ";
-var _id290 = componentCtx.data.datasource;
-if (_id290 instanceof Array) {
-for (var _id289 = 0; _id289 < _id290.length; _id289++) {
-componentCtx.data._id289=_id289;
-componentCtx.data.row= _id290[_id289];
+var _id6 = componentCtx.data.datasource;
+if (_id6 instanceof Array) {
+for (var _id5 = 0; _id5 < _id6.length; _id5++) {
+componentCtx.data._id5=_id5;
+componentCtx.data.row= _id6[_id5];
html += " ";
-var _id292 = componentCtx.data.columns;
-if (_id292 instanceof Array) {
-for (var _id291 = 0; _id291 < _id292.length; _id291++) {
-componentCtx.data._id291=_id291;
-componentCtx.data.col= _id292[_id291];
+var _id8 = componentCtx.data.columns;
+if (_id8 instanceof Array) {
+for (var _id7 = 0; _id7 < _id8.length; _id7++) {
+componentCtx.data._id7=_id7;
+componentCtx.data.col= _id8[_id7];
html += "- ";
-componentCtx.slotRenderers._id293 = componentCtx.slotRenderers._id293 || function () {
+componentCtx.slotRenderers._id9 = componentCtx.slotRenderers._id9 || function () {
function $defaultSlotRender(componentCtx) {
var html = "";
html += escapeHTML(componentCtx.data.row[componentCtx.data.col.name]);
@@ -261,17 +261,17 @@ for (var $renderIndex = 0; $renderIndex < $mySourceSlots.length; $renderIndex++)
html += $mySourceSlots[$renderIndex]($slotCtx);
}
};
-componentCtx.slotRenderers._id293();
+componentCtx.slotRenderers._id9();
html += "
";
}
-} else if (typeof _id292 === "object") {
-for (var _id291 in _id292) {
-if (_id292[_id291] != null) {
-componentCtx.data._id291=_id291;
-componentCtx.data.col= _id292[_id291];
+} else if (typeof _id8 === "object") {
+for (var _id7 in _id8) {
+if (_id8[_id7] != null) {
+componentCtx.data._id7=_id7;
+componentCtx.data.col= _id8[_id7];
html += "- ";
-componentCtx.slotRenderers._id294 = componentCtx.slotRenderers._id294 || function () {
+componentCtx.slotRenderers._id10 = componentCtx.slotRenderers._id10 || function () {
function $defaultSlotRender(componentCtx) {
var html = "";
html += escapeHTML(componentCtx.data.row[componentCtx.data.col.name]);
@@ -297,7 +297,7 @@ for (var $renderIndex = 0; $renderIndex < $mySourceSlots.length; $renderIndex++)
html += $mySourceSlots[$renderIndex]($slotCtx);
}
};
-componentCtx.slotRenderers._id294();
+componentCtx.slotRenderers._id10();
html += "
";
}
@@ -306,19 +306,19 @@ html += "";
html += "
";
}
-} else if (typeof _id290 === "object") {
-for (var _id289 in _id290) {
-if (_id290[_id289] != null) {
-componentCtx.data._id289=_id289;
-componentCtx.data.row= _id290[_id289];
+} else if (typeof _id6 === "object") {
+for (var _id5 in _id6) {
+if (_id6[_id5] != null) {
+componentCtx.data._id5=_id5;
+componentCtx.data.row= _id6[_id5];
html += " ";
-var _id296 = componentCtx.data.columns;
-if (_id296 instanceof Array) {
-for (var _id295 = 0; _id295 < _id296.length; _id295++) {
-componentCtx.data._id295=_id295;
-componentCtx.data.col= _id296[_id295];
+var _id12 = componentCtx.data.columns;
+if (_id12 instanceof Array) {
+for (var _id11 = 0; _id11 < _id12.length; _id11++) {
+componentCtx.data._id11=_id11;
+componentCtx.data.col= _id12[_id11];
html += "- ";
-componentCtx.slotRenderers._id297 = componentCtx.slotRenderers._id297 || function () {
+componentCtx.slotRenderers._id13 = componentCtx.slotRenderers._id13 || function () {
function $defaultSlotRender(componentCtx) {
var html = "";
html += escapeHTML(componentCtx.data.row[componentCtx.data.col.name]);
@@ -344,17 +344,17 @@ for (var $renderIndex = 0; $renderIndex < $mySourceSlots.length; $renderIndex++)
html += $mySourceSlots[$renderIndex]($slotCtx);
}
};
-componentCtx.slotRenderers._id297();
+componentCtx.slotRenderers._id13();
html += "
";
}
-} else if (typeof _id296 === "object") {
-for (var _id295 in _id296) {
-if (_id296[_id295] != null) {
-componentCtx.data._id295=_id295;
-componentCtx.data.col= _id296[_id295];
+} else if (typeof _id12 === "object") {
+for (var _id11 in _id12) {
+if (_id12[_id11] != null) {
+componentCtx.data._id11=_id11;
+componentCtx.data.col= _id12[_id11];
html += "- ";
-componentCtx.slotRenderers._id298 = componentCtx.slotRenderers._id298 || function () {
+componentCtx.slotRenderers._id14 = componentCtx.slotRenderers._id14 || function () {
function $defaultSlotRender(componentCtx) {
var html = "";
html += escapeHTML(componentCtx.data.row[componentCtx.data.col.name]);
@@ -380,7 +380,7 @@ for (var $renderIndex = 0; $renderIndex < $mySourceSlots.length; $renderIndex++)
html += $mySourceSlots[$renderIndex]($slotCtx);
}
};
-componentCtx.slotRenderers._id298();
+componentCtx.slotRenderers._id14();
html += "
";
}
@@ -394,8 +394,8 @@ html += "
";
html += "";
return html;
};
-componentRenderers._id285 = componentRenderers._id285|| _id285;
-var _id285Proto = {
+componentRenderers._id1 = componentRenderers._id1|| _id1;
+var _id1Proto = {
filters: {
},
@@ -407,10 +407,10 @@ computedNames: [
],
tagName: "div"
};
-function _id285(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id1(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id285Proto,
+proto: _id1Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -437,11 +437,11 @@ html += ">";
if (!noDataOutput) {
html += "";
}
-var _id300 = componentCtx.data.deps;
-if (_id300 instanceof Array) {
-for (var _id299 = 0; _id299 < _id300.length; _id299++) {
-componentCtx.data._id299=_id299;
-componentCtx.data.dep= _id300[_id299];
+var _id16 = componentCtx.data.deps;
+if (_id16 instanceof Array) {
+for (var _id15 = 0; _id15 < _id16.length; _id15++) {
+componentCtx.data._id15=_id15;
+componentCtx.data.dep= _id16[_id15];
var $sourceSlots = [];
$sourceSlots.push([function (componentCtx) {
var html = "";
@@ -451,17 +451,17 @@ html += "";
return html;
}, "col-" + escapeHTML(componentCtx.data.dep.strong)]);
-html += componentRenderers._id286(
+html += componentRenderers._id2(
{"columns":componentCtx.data.dep.columns,
"datasource":componentCtx.data.dep.members}, true, componentCtx, "x-table", $sourceSlots);
$sourceSlots = null;
}
-} else if (typeof _id300 === "object") {
-for (var _id299 in _id300) {
-if (_id300[_id299] != null) {
-componentCtx.data._id299=_id299;
-componentCtx.data.dep= _id300[_id299];
+} else if (typeof _id16 === "object") {
+for (var _id15 in _id16) {
+if (_id16[_id15] != null) {
+componentCtx.data._id15=_id15;
+componentCtx.data.dep= _id16[_id15];
var $sourceSlots = [];
$sourceSlots.push([function (componentCtx) {
var html = "";
@@ -471,7 +471,7 @@ html += "";
return html;
}, "col-" + escapeHTML(componentCtx.data.dep.strong)]);
-html += componentRenderers._id286(
+html += componentRenderers._id2(
{"columns":componentCtx.data.dep.columns,
"datasource":componentCtx.data.dep.members}, true, componentCtx, "x-table", $sourceSlots);
$sourceSlots = null;
@@ -482,5 +482,5 @@ $sourceSlots = null;
html += "";
return html;
};
-return componentRenderers._id285(data, noDataOutput)
+return componentRenderers._id1(data, noDataOutput)
}
\ No newline at end of file
diff --git a/test/cases/slot-shake-desc-ele-name/ssr.php b/test/cases/slot-shake-desc-ele-name/ssr.php
new file mode 100644
index 00000000..2ac60b81
--- /dev/null
+++ b/test/cases/slot-shake-desc-ele-name/ssr.php
@@ -0,0 +1,172 @@
+ [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id2Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$html .= " ";
+$_id4 = (isset($componentCtx["data"]["columns"]) ? $componentCtx["data"]["columns"] : null);
+if (is_array($_id4)) {
+foreach ($_id4 as $_id3 => $value) {
+$componentCtx["data"]["_id3"] = $_id3;
+$componentCtx["data"]["col"] = $value;
+$html .= "
";
+$html .= San::escapeHTML((isset($componentCtx["data"]["col"]["label"]) ? $componentCtx["data"]["col"]["label"] : null));
+$html .= "
";
+
+}
+}
+$html .= " ";
+$_id6 = (isset($componentCtx["data"]["datasource"]) ? $componentCtx["data"]["datasource"] : null);
+if (is_array($_id6)) {
+foreach ($_id6 as $_id5 => $value) {
+$componentCtx["data"]["_id5"] = $_id5;
+$componentCtx["data"]["row"] = $value;
+$html .= "
";
+$_id8 = (isset($componentCtx["data"]["columns"]) ? $componentCtx["data"]["columns"] : null);
+if (is_array($_id8)) {
+foreach ($_id8 as $_id7 => $value) {
+$componentCtx["data"]["_id7"] = $_id7;
+$componentCtx["data"]["col"] = $value;
+$html .= "- ";
+if (!isset($componentCtx["slotRenderers"]["_id9"])) $componentCtx["slotRenderers"]["_id9"] = function () use (&$componentCtx, &$html){
+$defaultSlotRender = function ($componentCtx) {
+ $html = "";
+$html .= San::escapeHTML((isset($componentCtx["data"]["row"][(isset($componentCtx["data"]["col"]["name"]) ? $componentCtx["data"]["col"]["name"] : null)]) ? $componentCtx["data"]["row"][(isset($componentCtx["data"]["col"]["name"]) ? $componentCtx["data"]["col"]["name"] : null)] : null));
+
+ return $html;
+};
+$isInserted = false;
+$ctxSourceSlots = $componentCtx["sourceSlots"];
+$mySourceSlots = [];
+$slotName = "col-" . San::escapeHTML((isset($componentCtx["data"]["col"]["name"]) ? $componentCtx["data"]["col"]["name"] : null));
+foreach ($ctxSourceSlots as $i => $slot) {
+ if (count($slot) > 1 && $slot[1] == $slotName) {
+ array_push($mySourceSlots, $slot[0]);
+ $isInserted = true;
+ }
+}
+if (!$isInserted) { array_push($mySourceSlots, $defaultSlotRender); }
+$slotCtx = $isInserted ? $componentCtx["owner"] : $componentCtx;
+$slotCtx = ["data" => $slotCtx["data"], "proto" => $slotCtx["proto"], "owner" => $slotCtx["owner"]];
+$slotCtx["data"]["row"] = (isset($componentCtx["data"]["row"]) ? $componentCtx["data"]["row"] : null);
+$slotCtx["data"]["col"] = (isset($componentCtx["data"]["col"]) ? $componentCtx["data"]["col"] : null);
+foreach ($mySourceSlots as $renderIndex => $slot) {
+ $html .= $slot($slotCtx);
+}
+};
+call_user_func($componentCtx["slotRenderers"]["_id9"]);
+$html .= "
";
+
+}
+}
+$html .= "
";
+
+}
+}
+$html .= "
";
+return $html;
+};
+function _id1($data, $noDataOutput = false, $parentCtx = [], $tagName = null, $sourceSlots = []) {
+$_id1Proto = [
+"filters" => [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id1Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$_id11 = (isset($componentCtx["data"]["deps"]) ? $componentCtx["data"]["deps"] : null);
+if (is_array($_id11)) {
+foreach ($_id11 as $_id10 => $value) {
+$componentCtx["data"]["_id10"] = $_id10;
+$componentCtx["data"]["dep"] = $value;
+$sourceSlots = [];
+array_push($sourceSlots, [function ($componentCtx) {
+ $html = "";
+$html .= "";
+$html .= San::escapeHTML((isset($componentCtx["data"]["row"][(isset($componentCtx["data"]["col"]["name"]) ? $componentCtx["data"]["col"]["name"] : null)]) ? $componentCtx["data"]["row"][(isset($componentCtx["data"]["col"]["name"]) ? $componentCtx["data"]["col"]["name"] : null)] : null));
+$html .= "";
+
+ return $html;
+}, "col-" . San::escapeHTML((isset($componentCtx["data"]["dep"]["strong"]) ? $componentCtx["data"]["dep"]["strong"] : null))]);
+$html .= call_user_func("_id2",
+["columns" => (isset($componentCtx["data"]["dep"]["columns"]) ? $componentCtx["data"]["dep"]["columns"] : null),
+"datasource" => (isset($componentCtx["data"]["dep"]["members"]) ? $componentCtx["data"]["dep"]["members"] : null)], true, $componentCtx, "x-table", $sourceSlots);
+$sourceSlots = null;
+
+}
+}
+$html .= "
";
+return $html;
+};
+return call_user_func("_id1", $data, $noDataOutput);
+}; ?>
\ No newline at end of file
diff --git a/test/cases/style-and-class-autoexpand/ssr.js b/test/cases/style-and-class-autoexpand/ssr.js
index 0ac85445..bd43ab1a 100644
--- a/test/cases/style-and-class-autoexpand/ssr.js
+++ b/test/cases/style-and-class-autoexpand/ssr.js
@@ -156,8 +156,8 @@ function defaultStyleFilter (source) {
return source
}
-componentRenderers._id303 = componentRenderers._id303|| _id303;
-var _id303Proto = {
+componentRenderers._id2 = componentRenderers._id2|| _id2;
+var _id2Proto = {
filters: {
},
@@ -169,10 +169,10 @@ computedNames: [
],
tagName: "span"
};
-function _id303(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id2(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id303Proto,
+proto: _id2Proto,
sourceSlots: sourceSlots,
data: data || {"styles":{"main":{"position":"fixed","display":"block"}},"classes":{"main":["ui","ui-label"]}},
owner: parentCtx,
@@ -200,8 +200,8 @@ html += "";
html += "label";
return html;
};
-componentRenderers._id302 = componentRenderers._id302|| _id302;
-var _id302Proto = {
+componentRenderers._id1 = componentRenderers._id1|| _id1;
+var _id1Proto = {
filters: {
},
@@ -213,10 +213,10 @@ computedNames: [
],
tagName: "a"
};
-function _id302(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id1(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id302Proto,
+proto: _id1Proto,
sourceSlots: sourceSlots,
data: data || {"styles":{"main":{"width":"50px","height":"50px"},"title":{"width":"50px","height":"20px"}},"classes":{"main":["app","main"],"title":["app-title","main-title"]}},
owner: parentCtx,
@@ -250,11 +250,11 @@ html += attrFilter("style", escapeHTML(_styleFilter(componentCtx.data.styles.tit
}
html += ">";
var $sourceSlots = [];
-html += componentRenderers._id303(
+html += componentRenderers._id2(
{}, true, componentCtx, "ui-label", $sourceSlots);
$sourceSlots = null;
html += "";
return html;
};
-return componentRenderers._id302(data, noDataOutput)
+return componentRenderers._id1(data, noDataOutput)
}
\ No newline at end of file
diff --git a/test/cases/style-and-class-autoexpand/ssr.php b/test/cases/style-and-class-autoexpand/ssr.php
new file mode 100644
index 00000000..2782bb31
--- /dev/null
+++ b/test/cases/style-and-class-autoexpand/ssr.php
@@ -0,0 +1,99 @@
+ [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "span"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id2Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : ["styles" => ["main" => ["position" => "fixed","display" => "block"]],"classes" => ["main" => ["ui","ui-label"]]],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+$componentCtx["data"]["styles"] = isset($componentCtx["data"]["styles"]) ? $componentCtx["data"]["styles"] : ["main" => ["position" => "fixed","display" => "block"]];
+$componentCtx["data"]["classes"] = isset($componentCtx["data"]["classes"]) ? $componentCtx["data"]["classes"] : ["main" => ["ui","ui-label"]];
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$html .= "label";
+return $html;
+};
+function _id1($data, $noDataOutput = false, $parentCtx = [], $tagName = null, $sourceSlots = []) {
+$_id1Proto = [
+"filters" => [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "a"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id1Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : ["styles" => ["main" => ["width" => "50px","height" => "50px"],"title" => ["width" => "50px","height" => "20px"]],"classes" => ["main" => ["app","main"],"title" => ["app-title","main-title"]]],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+$componentCtx["data"]["styles"] = isset($componentCtx["data"]["styles"]) ? $componentCtx["data"]["styles"] : ["main" => ["width" => "50px","height" => "50px"],"title" => ["width" => "50px","height" => "20px"]];
+$componentCtx["data"]["classes"] = isset($componentCtx["data"]["classes"]) ? $componentCtx["data"]["classes"] : ["main" => ["app","main"],"title" => ["app-title","main-title"]];
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$html .= "
\ No newline at end of file
diff --git a/test/cases/text-value-binding/ssr.js b/test/cases/text-value-binding/ssr.js
index 0c1fbce1..fabb3295 100644
--- a/test/cases/text-value-binding/ssr.js
+++ b/test/cases/text-value-binding/ssr.js
@@ -156,8 +156,8 @@ function defaultStyleFilter (source) {
return source
}
-componentRenderers._id305 = componentRenderers._id305|| _id305;
-var _id305Proto = {
+componentRenderers._id1 = componentRenderers._id1|| _id1;
+var _id1Proto = {
filters: {
},
@@ -169,10 +169,10 @@ computedNames: [
],
tagName: "div"
};
-function _id305(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id1(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id305Proto,
+proto: _id1Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -212,5 +212,5 @@ html += attrFilter("value", escapeHTML(componentCtx.data.name));
html += ">";
return html;
};
-return componentRenderers._id305(data, noDataOutput)
+return componentRenderers._id1(data, noDataOutput)
}
\ No newline at end of file
diff --git a/test/cases/text-value-binding/ssr.php b/test/cases/text-value-binding/ssr.php
new file mode 100644
index 00000000..f4230105
--- /dev/null
+++ b/test/cases/text-value-binding/ssr.php
@@ -0,0 +1,57 @@
+ [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id1Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "
";
+}
+$html .= "
\ No newline at end of file
diff --git a/test/cases/textarea-value-binding/ssr.js b/test/cases/textarea-value-binding/ssr.js
index e29563b5..3ca67998 100644
--- a/test/cases/textarea-value-binding/ssr.js
+++ b/test/cases/textarea-value-binding/ssr.js
@@ -156,8 +156,8 @@ function defaultStyleFilter (source) {
return source
}
-componentRenderers._id307 = componentRenderers._id307|| _id307;
-var _id307Proto = {
+componentRenderers._id1 = componentRenderers._id1|| _id1;
+var _id1Proto = {
filters: {
},
@@ -169,10 +169,10 @@ computedNames: [
],
tagName: "div"
};
-function _id307(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id1(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id307Proto,
+proto: _id1Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -210,5 +210,5 @@ html += escapeHTML(componentCtx.data.name);
html += "
";
return html;
};
-return componentRenderers._id307(data, noDataOutput)
+return componentRenderers._id1(data, noDataOutput)
}
\ No newline at end of file
diff --git a/test/cases/textarea-value-binding/ssr.php b/test/cases/textarea-value-binding/ssr.php
new file mode 100644
index 00000000..96f0c4ad
--- /dev/null
+++ b/test/cases/textarea-value-binding/ssr.php
@@ -0,0 +1,55 @@
+ [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id1Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$html .= "
\ No newline at end of file
diff --git a/test/cases/update-attribute/ssr.js b/test/cases/update-attribute/ssr.js
index 98e8dceb..5bfac43f 100644
--- a/test/cases/update-attribute/ssr.js
+++ b/test/cases/update-attribute/ssr.js
@@ -156,8 +156,8 @@ function defaultStyleFilter (source) {
return source
}
-componentRenderers._id309 = componentRenderers._id309|| _id309;
-var _id309Proto = {
+componentRenderers._id1 = componentRenderers._id1|| _id1;
+var _id1Proto = {
filters: {
},
@@ -169,10 +169,10 @@ computedNames: [
],
tagName: "a"
};
-function _id309(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id1(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id309Proto,
+proto: _id1Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -208,5 +208,5 @@ html += escapeHTML(componentCtx.data.name);
html += "";
return html;
};
-return componentRenderers._id309(data, noDataOutput)
+return componentRenderers._id1(data, noDataOutput)
}
\ No newline at end of file
diff --git a/test/cases/update-attribute/ssr.php b/test/cases/update-attribute/ssr.php
new file mode 100644
index 00000000..d55f23e3
--- /dev/null
+++ b/test/cases/update-attribute/ssr.php
@@ -0,0 +1,53 @@
+ [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "a"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id1Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "
";
+}
+$html .= "
\ No newline at end of file
diff --git a/test/cases/update-cmpt-has-attr/ssr.js b/test/cases/update-cmpt-has-attr/ssr.js
index ce715c53..0b7e07c4 100644
--- a/test/cases/update-cmpt-has-attr/ssr.js
+++ b/test/cases/update-cmpt-has-attr/ssr.js
@@ -156,8 +156,8 @@ function defaultStyleFilter (source) {
return source
}
-componentRenderers._id315 = componentRenderers._id315|| _id315;
-var _id315Proto = {
+componentRenderers._id2 = componentRenderers._id2|| _id2;
+var _id2Proto = {
filters: {
},
@@ -169,10 +169,10 @@ computedNames: [
],
tagName: "span"
};
-function _id315(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id2(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id315Proto,
+proto: _id2Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -204,8 +204,8 @@ html += escapeHTML(componentCtx.data.text);
html += "";
return html;
};
-componentRenderers._id314 = componentRenderers._id314|| _id314;
-var _id314Proto = {
+componentRenderers._id1 = componentRenderers._id1|| _id1;
+var _id1Proto = {
filters: {
},
@@ -217,10 +217,10 @@ computedNames: [
],
tagName: "div"
};
-function _id314(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id1(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id314Proto,
+proto: _id1Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -249,7 +249,7 @@ html += "";
}
html += "";
var $sourceSlots = [];
-html += componentRenderers._id315(
+html += componentRenderers._id2(
{"text":componentCtx.data.jokeName,
"class":escapeHTML(_classFilter(componentCtx.data.labelClass)) + " my-label"}, true, componentCtx, "ui-label", $sourceSlots);
$sourceSlots = null;
@@ -260,5 +260,5 @@ html += escapeHTML(componentCtx.data.company);
html += "
";
return html;
};
-return componentRenderers._id314(data, noDataOutput)
+return componentRenderers._id1(data, noDataOutput)
}
\ No newline at end of file
diff --git a/test/cases/update-cmpt-has-attr/ssr.php b/test/cases/update-cmpt-has-attr/ssr.php
new file mode 100644
index 00000000..12a713fe
--- /dev/null
+++ b/test/cases/update-cmpt-has-attr/ssr.php
@@ -0,0 +1,103 @@
+ [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "span"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id2Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$html .= San::escapeHTML((array_key_exists("text", $componentCtx["data"]) ? $componentCtx["data"]["text"] : null));
+$html .= "";
+return $html;
+};
+function _id1($data, $noDataOutput = false, $parentCtx = [], $tagName = null, $sourceSlots = []) {
+$_id1Proto = [
+"filters" => [
+
+],
+"computed" => [
+
+],
+"computedNames" => [
+
+],
+"tagName" => "div"
+];
+$html = "";
+$componentCtx = [
+"proto" => $_id1Proto,
+"sourceSlots" => $sourceSlots,
+"data" => $data ? $data : [],
+"owner" => $parentCtx,
+"slotRenderers" => []
+];
+if ($data) {
+}
+$computedNames = $componentCtx["proto"]["computedNames"];
+foreach ($computedNames as $i => $computedName) {
+ $data[$computedName] = $componentCtx["proto"]["computed"][$computedName]($componentCtx);
+}
+$html .= "";
+}
+$html .= "
";
+$sourceSlots = [];
+$html .= call_user_func("_id2",
+["text" => (array_key_exists("jokeName", $componentCtx["data"]) ? $componentCtx["data"]["jokeName"] : null),
+"class" => San::escapeHTML(San::_classFilter((array_key_exists("labelClass", $componentCtx["data"]) ? $componentCtx["data"]["labelClass"] : null))) . " my-label"], true, $componentCtx, "ui-label", $sourceSlots);
+$sourceSlots = null;
+$html .= "
";
+$html .= San::escapeHTML((array_key_exists("school", $componentCtx["data"]) ? $componentCtx["data"]["school"] : null));
+$html .= "";
+$html .= San::escapeHTML((array_key_exists("company", $componentCtx["data"]) ? $componentCtx["data"]["company"] : null));
+$html .= "
";
+return $html;
+};
+return call_user_func("_id1", $data, $noDataOutput);
+}; ?>
\ No newline at end of file
diff --git a/test/cases/update-cmpt/ssr.js b/test/cases/update-cmpt/ssr.js
index 8bf5436c..9cc14d66 100644
--- a/test/cases/update-cmpt/ssr.js
+++ b/test/cases/update-cmpt/ssr.js
@@ -156,8 +156,8 @@ function defaultStyleFilter (source) {
return source
}
-componentRenderers._id312 = componentRenderers._id312|| _id312;
-var _id312Proto = {
+componentRenderers._id2 = componentRenderers._id2|| _id2;
+var _id2Proto = {
filters: {
},
@@ -169,10 +169,10 @@ computedNames: [
],
tagName: "a"
};
-function _id312(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id2(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id312Proto,
+proto: _id2Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -208,8 +208,8 @@ html += escapeHTML(componentCtx.data.text);
html += "";
return html;
};
-componentRenderers._id311 = componentRenderers._id311|| _id311;
-var _id311Proto = {
+componentRenderers._id1 = componentRenderers._id1|| _id1;
+var _id1Proto = {
filters: {
},
@@ -221,10 +221,10 @@ computedNames: [
],
tagName: "div"
};
-function _id311(data, noDataOutput, parentCtx, tagName, sourceSlots) {
+function _id1(data, noDataOutput, parentCtx, tagName, sourceSlots) {
var html = "";
var componentCtx = {
-proto: _id311Proto,
+proto: _id1Proto,
sourceSlots: sourceSlots,
data: data || {},
owner: parentCtx,
@@ -253,7 +253,7 @@ html += "";
}
html += "