Comparing version 0.1.0 to 0.1.1
/*! | ||
* Omi v0.1.0 By dntzhang | ||
* Omi v0.1.1 By dntzhang | ||
* Github: https://github.com/AlloyTeam/omi | ||
@@ -934,2 +934,3 @@ * MIT Licensed. | ||
this._preCSS = null; | ||
this._combinedData = null; | ||
if (this._omi_server_rendering || isReRendering) { | ||
@@ -1131,3 +1132,3 @@ this.install(); | ||
this._mergeData(childStr, isFirst); | ||
this._generateHTMLCSS(); | ||
this._generateHTMLCSS(true); | ||
this._extractChildren(this); | ||
@@ -1235,3 +1236,3 @@ if (isFirst) { | ||
var arr = childStr.match(/\s*data=['|"](\S*)['|"]/); | ||
this.data = Object.assign({}, this._getDataset(childStr), arr ? this.parent[RegExp.$1] : null, this.data); | ||
this._combinedData = Object.assign({}, this._getDataset(childStr), arr ? this.parent[RegExp.$1] : null, this.data); | ||
isFirst && this.install(); | ||
@@ -1241,3 +1242,3 @@ } | ||
key: '_generateHTMLCSS', | ||
value: function _generateHTMLCSS() { | ||
value: function _generateHTMLCSS(isChild) { | ||
this.CSS = this.style() || ''; | ||
@@ -1252,6 +1253,6 @@ if (this.CSS) { | ||
var tpl = this.render(); | ||
this.HTML = this._scopedAttr(_omi2.default.template(tpl ? tpl : "", this.data), _omi2.default.STYLESCOPEDPREFIX + this.id).trim(); | ||
this.HTML = this._scopedAttr(_omi2.default.template(tpl ? tpl : "", isChild ? this._combinedData : this.data), _omi2.default.STYLESCOPEDPREFIX + this.id).trim(); | ||
if (this._omi_server_rendering) { | ||
this.HTML = '\r\n<style id="' + _omi2.default.STYLEPREFIX + this.id + '">\r\n' + this.CSS + '\r\n</style>\r\n' + this.HTML; | ||
this.HTML += '\r\n<input type="hidden" data-omi-id="' + this.id + '" class="' + _omi2.default.STYLESCOPEDPREFIX + '_hidden_data" value=\'' + JSON.stringify(this.data) + '\' />\r\n'; | ||
this.HTML += '\r\n<input type="hidden" data-omi-id="' + this.id + '" class="' + _omi2.default.STYLESCOPEDPREFIX + '_hidden_data" value=\'' + JSON.stringify(isChild ? this._combinedData : this.data) + '\' />\r\n'; | ||
} | ||
@@ -1258,0 +1259,0 @@ } |
/*! | ||
* Omi v0.1.0 By dntzhang | ||
* Omi v0.1.1 By dntzhang | ||
* Github: https://github.com/AlloyTeam/omi | ||
@@ -317,2 +317,3 @@ * MIT Licensed. | ||
this._preCSS = null; | ||
this._combinedData = null; | ||
if (this._omi_server_rendering || isReRendering) { | ||
@@ -514,3 +515,3 @@ this.install(); | ||
this._mergeData(childStr, isFirst); | ||
this._generateHTMLCSS(); | ||
this._generateHTMLCSS(true); | ||
this._extractChildren(this); | ||
@@ -618,3 +619,3 @@ if (isFirst) { | ||
var arr = childStr.match(/\s*data=['|"](\S*)['|"]/); | ||
this.data = Object.assign({}, this._getDataset(childStr), arr ? this.parent[RegExp.$1] : null, this.data); | ||
this._combinedData = Object.assign({}, this._getDataset(childStr), arr ? this.parent[RegExp.$1] : null, this.data); | ||
isFirst && this.install(); | ||
@@ -624,3 +625,3 @@ } | ||
key: '_generateHTMLCSS', | ||
value: function _generateHTMLCSS() { | ||
value: function _generateHTMLCSS(isChild) { | ||
this.CSS = this.style() || ''; | ||
@@ -635,6 +636,6 @@ if (this.CSS) { | ||
var tpl = this.render(); | ||
this.HTML = this._scopedAttr(_omi2.default.template(tpl ? tpl : "", this.data), _omi2.default.STYLESCOPEDPREFIX + this.id).trim(); | ||
this.HTML = this._scopedAttr(_omi2.default.template(tpl ? tpl : "", isChild ? this._combinedData : this.data), _omi2.default.STYLESCOPEDPREFIX + this.id).trim(); | ||
if (this._omi_server_rendering) { | ||
this.HTML = '\r\n<style id="' + _omi2.default.STYLEPREFIX + this.id + '">\r\n' + this.CSS + '\r\n</style>\r\n' + this.HTML; | ||
this.HTML += '\r\n<input type="hidden" data-omi-id="' + this.id + '" class="' + _omi2.default.STYLESCOPEDPREFIX + '_hidden_data" value=\'' + JSON.stringify(this.data) + '\' />\r\n'; | ||
this.HTML += '\r\n<input type="hidden" data-omi-id="' + this.id + '" class="' + _omi2.default.STYLESCOPEDPREFIX + '_hidden_data" value=\'' + JSON.stringify(isChild ? this._combinedData : this.data) + '\' />\r\n'; | ||
} | ||
@@ -641,0 +642,0 @@ } |
@@ -942,2 +942,3 @@ /*! | ||
this._preCSS = null; | ||
this._combinedData = null; | ||
if (this._omi_server_rendering || isReRendering) { | ||
@@ -1139,3 +1140,3 @@ this.install(); | ||
this._mergeData(childStr, isFirst); | ||
this._generateHTMLCSS(); | ||
this._generateHTMLCSS(true); | ||
this._extractChildren(this); | ||
@@ -1243,3 +1244,3 @@ if (isFirst) { | ||
var arr = childStr.match(/\s*data=['|"](\S*)['|"]/); | ||
this.data = Object.assign({}, this._getDataset(childStr), arr ? this.parent[RegExp.$1] : null, this.data); | ||
this._combinedData = Object.assign({}, this._getDataset(childStr), arr ? this.parent[RegExp.$1] : null, this.data); | ||
isFirst && this.install(); | ||
@@ -1249,3 +1250,3 @@ } | ||
key: '_generateHTMLCSS', | ||
value: function _generateHTMLCSS() { | ||
value: function _generateHTMLCSS(isChild) { | ||
this.CSS = this.style() || ''; | ||
@@ -1260,6 +1261,6 @@ if (this.CSS) { | ||
var tpl = this.render(); | ||
this.HTML = this._scopedAttr(_omi2.default.template(tpl ? tpl : "", this.data), _omi2.default.STYLESCOPEDPREFIX + this.id).trim(); | ||
this.HTML = this._scopedAttr(_omi2.default.template(tpl ? tpl : "", isChild ? this._combinedData : this.data), _omi2.default.STYLESCOPEDPREFIX + this.id).trim(); | ||
if (this._omi_server_rendering) { | ||
this.HTML = '\r\n<style id="' + _omi2.default.STYLEPREFIX + this.id + '">\r\n' + this.CSS + '\r\n</style>\r\n' + this.HTML; | ||
this.HTML += '\r\n<input type="hidden" data-omi-id="' + this.id + '" class="' + _omi2.default.STYLESCOPEDPREFIX + '_hidden_data" value=\'' + JSON.stringify(this.data) + '\' />\r\n'; | ||
this.HTML += '\r\n<input type="hidden" data-omi-id="' + this.id + '" class="' + _omi2.default.STYLESCOPEDPREFIX + '_hidden_data" value=\'' + JSON.stringify(isChild ? this._combinedData : this.data) + '\' />\r\n'; | ||
} | ||
@@ -1266,0 +1267,0 @@ } |
{ | ||
"name": "omi", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Omi is Omi.", | ||
@@ -13,2 +13,3 @@ "scripts": { | ||
"timer": "webpack -w", | ||
"communication": "webpack -w", | ||
"todo": "webpack -w", | ||
@@ -15,0 +16,0 @@ "artTemplate": "webpack -w", |
@@ -13,6 +13,8 @@ <p align="center"> | ||
## 中文 | [English](https://github.com/AlloyTeam/omi#中文--english-1) | ||
* 如果想体验一下Omi框架,请[点击Omi Playground](http://alloyteam.github.io/omi/example/playground/) | ||
* 如果想使用Omi框架,请阅读 [Omi使用文档](https://github.com/AlloyTeam/omi/tree/master/docs#omi使用文档) | ||
* 如果想一起开发完善Omi框架,有更好的解决方案或者思路,请阅读 [从零一步步打造web组件化框架Omi](https://github.com/AlloyTeam/omi/tree/master/docs#从零一步步打造web组件化框架omi) | ||
* 关于上面的两类文档,如果你想获得更佳的阅读体验,可以访问[http://alloyteam.github.io/omi](http://alloyteam.github.io/omi) | ||
* 关于上面的两类文档,如果你想获得更佳的阅读体验,可以访问[Docs Website](http://alloyteam.github.io/omi/website/docs.html) | ||
* 如果你懒得搭建项目脚手架,可以试试[Scaffolding for Omi](https://github.com/AlloyTeam/omi/tree/master/scaffolding),npm安装omis便可 | ||
@@ -86,3 +88,75 @@ * 如果你有Omi相关的问题可以[New issue](https://github.com/AlloyTeam/omi/issues/new) | ||
## [中文](https://github.com/AlloyTeam/omi#中文--english) | English | ||
* If you want to experience the Omi framework, please click [Omi Playground](http://alloyteam.github.io/omi/example/playground/) | ||
* If you want to use the Omi framework,please read [the Omi documentation](https://github.com/AlloyTeam/omi/tree/master/docs#omi使用文档) | ||
* If you want to develop and improve the Omi framework, there are better solutions or ideas, please read [develop the Omi framework step by step](https://github.com/AlloyTeam/omi/tree/master/docs#从零一步步打造web组件化框架omi) | ||
* If you want to get a better reading experience of the above two categories of documents, you can visit[Docs Website](http://alloyteam.github.io/omi/website/docs.html) | ||
* If you are too lazy to build a project scaffolding, you can try [Scaffolding for Omi](https://github.com/AlloyTeam/omi/tree/master/scaffolding) | ||
* If you have Any problems,please [New issue](https://github.com/AlloyTeam/omi/issues/new) | ||
* If you want to be more convenient on the exchange of all Omi can join the QQ Omi exchange group (256426170) | ||
## Install | ||
``` js | ||
npm install omi | ||
``` | ||
## Hello World | ||
```js | ||
class Hello extends Omi.Component { | ||
constructor(data) { | ||
super(data); | ||
} | ||
style () { | ||
return ` | ||
h1{ | ||
cursor:pointer; | ||
} | ||
`; | ||
} | ||
handleClick(target, evt){ | ||
alert(target.innerHTML); | ||
} | ||
render() { | ||
return ` | ||
<div> | ||
<h1 onclick="handleClick(this, event)">Hello ,{{name}}!</h1> | ||
</div> | ||
`; | ||
} | ||
} | ||
Omi.render(new Hello({ name : "Omi" }),"body"); | ||
``` | ||
[[Try it on Playground]](http://alloyteam.github.io/omi/website/redirect.html?type=hello) | ||
You can use Omi.makeHTML to generate component tags for nesting. | ||
```js | ||
Omi.makeHTML('Hello', Hello); | ||
``` | ||
Then you can use it in other components, and pass parameter to the component through the data-* , such as: | ||
```js | ||
... | ||
render() { | ||
return ` | ||
<div> | ||
<div>Test</div> | ||
<Hello data-name="Omi" /> | ||
</div> | ||
`; | ||
} | ||
... | ||
``` | ||
[[Try it on Playground]](http://alloyteam.github.io/omi/website/redirect.html?type=hello_nest) | ||
You can use [webpack](https://webpack.github.io/) + [babel](http://babeljs.io/),configure the [babel-loader](https://github.com/babel/babel-loader) in the module settings of webpack,then you can use ES6+ to write your web program. | ||
Omi did not abandon the ES5 users, you can also use ES5 to write Omi.[[Try Omi-ES5 on Playground]](http://alloyteam.github.io/omi/website/redirect.html?type=hello_es5) | ||
# License | ||
This content is released under the [MIT](http://opensource.org/licenses/MIT) License. |
@@ -30,2 +30,3 @@ import Omi from './omi.js'; | ||
this._preCSS = null; | ||
this._combinedData = null; | ||
if (this._omi_server_rendering || isReRendering) { | ||
@@ -208,3 +209,3 @@ this.install(); | ||
this._mergeData(childStr,isFirst); | ||
this._generateHTMLCSS(); | ||
this._generateHTMLCSS(true); | ||
this._extractChildren(this); | ||
@@ -304,7 +305,7 @@ if(isFirst){ | ||
let arr = childStr.match(/\s*data=['|"](\S*)['|"]/); | ||
this.data = Object.assign({}, this._getDataset(childStr), arr ? this.parent[RegExp.$1] : null, this.data); | ||
this._combinedData = Object.assign({}, this._getDataset(childStr), arr ? this.parent[RegExp.$1] : null, this.data); | ||
isFirst && this.install(); | ||
} | ||
_generateHTMLCSS() { | ||
_generateHTMLCSS(isChild) { | ||
this.CSS = this.style() || ''; | ||
@@ -319,6 +320,6 @@ if (this.CSS) { | ||
let tpl = this.render(); | ||
this.HTML = this._scopedAttr(Omi.template(tpl ? tpl : "", this.data), Omi.STYLESCOPEDPREFIX + this.id).trim(); | ||
this.HTML = this._scopedAttr(Omi.template(tpl ? tpl : "",isChild ? this._combinedData : this.data), Omi.STYLESCOPEDPREFIX + this.id).trim(); | ||
if (this._omi_server_rendering) { | ||
this.HTML = '\r\n<style id="'+Omi.STYLEPREFIX+this.id+'">\r\n' + this.CSS + '\r\n</style>\r\n'+this.HTML ; | ||
this.HTML += '\r\n<input type="hidden" data-omi-id="' + this.id + '" class="' + Omi.STYLESCOPEDPREFIX + '_hidden_data" value=\'' + JSON.stringify(this.data) + '\' />\r\n' | ||
this.HTML += '\r\n<input type="hidden" data-omi-id="' + this.id + '" class="' + Omi.STYLESCOPEDPREFIX + '_hidden_data" value=\'' + JSON.stringify(isChild ? this._combinedData : this.data) + '\' />\r\n' | ||
} | ||
@@ -325,0 +326,0 @@ } |
@@ -67,3 +67,3 @@ var path = require('path'); | ||
// Avoid publishing files when compilation fails | ||
new webpack.BannerPlugin(" Omi v0.1.0 By dntzhang \r\n Github: https://github.com/AlloyTeam/omi\r\n MIT Licensed."), | ||
new webpack.BannerPlugin(" Omi v0.1.1 By dntzhang \r\n Github: https://github.com/AlloyTeam/omi\r\n MIT Licensed."), | ||
new webpack.NoErrorsPlugin() | ||
@@ -70,0 +70,0 @@ ], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1754296
160
31027
160
0