Skip to content
Open
Show file tree
Hide file tree
Changes from 63 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
914dce7
Initial work on new DOM updater
kayleg Feb 2, 2019
e244069
Remove explicit input list
kayleg Feb 2, 2019
e8649da
Started port of repeat to new DOM updater
kayleg Feb 4, 2019
7e1f938
Port more functions to new updater. Use IntersectionObserver if possible
kayleg Feb 28, 2019
5b21557
Moved to smart event/attribute compilers. Set closure to output ECMA6.
kayleg Mar 7, 2019
d4f5bc5
Removed md5 dependency and JSON stringify from repeat diff detection
kayleg Mar 7, 2019
e3c1b09
Removed unused function
kayleg Mar 7, 2019
8080e0a
Added jsdelivr main file
kayleg Mar 7, 2019
8f5aeb9
Removed extra call to class set
kayleg Mar 7, 2019
94ce777
Add brotli to compression step
kayleg Mar 7, 2019
7479250
Add ability to ignore dataset entries. Made Silica event specific
kayleg Mar 7, 2019
c183a20
Explicitly check against null. Fixes #31
kayleg Mar 7, 2019
577fa55
Use 2 node lists for tracking nodes to update
kayleg Mar 7, 2019
09eece7
Convert mustache syntax to data-model at compile time
kayleg Mar 7, 2019
6386f53
Bump to beta
kayleg Mar 7, 2019
dc924a4
Beta build
kayleg Mar 7, 2019
618108a
Version bump
kayleg Mar 7, 2019
9ac9b49
Fixed a bug with mustache syntax compilation
kayleg Mar 7, 2019
909e362
Fixed issue where nodes hidden by data-show wouldn't update other data
kayleg Mar 8, 2019
7142937
Fixed innerHTML binding
kayleg Mar 12, 2019
3eb992d
Fix click outside, trap, parameter
kayleg Mar 29, 2019
81cc439
Use value for textarea
kayleg Apr 1, 2019
beec77f
Version Bump
kayleg Apr 1, 2019
8fd513d
Add support for inner-text and inner-html. Improve how multiple apply
kayleg May 24, 2019
ffea7e3
Re-enable data-trap, fix include caching. More performance improvements
kayleg Jun 17, 2019
6d96e4f
Version bump
kayleg Jun 17, 2019
bf7eafb
Fix repeat index
kayleg Jun 18, 2019
4822f02
Fix recursive cached includes
kayleg Jun 18, 2019
6cc09c2
Prevent shifting cached keys
kayleg Jul 8, 2019
65b554b
prevent destructors from getting renamed
kayleg Oct 22, 2019
f08f5f0
Disconnect from intersection observer on removal
kayleg Nov 4, 2019
b08cb4b
Version Bump
kayleg Nov 4, 2019
9b3aef3
Fixed repeat links not capturing href
kayleg Jun 5, 2020
98b58e9
0.60.0-rc3
kayleg Jun 5, 2020
ed139e3
Fixes #35 Passed current target el in SiO2-HREF pub when event is han…
jdejesus007 Jun 8, 2020
0cac721
Passed current target in SiO2 as second argument
jdejesus007 Jun 9, 2020
f61faeb
Merge pull request #36 from jdejesus007/bugfix/sio2-href
kayleg Jun 9, 2020
220caca
Merge branch 'feature/new-dom-updater' of github.com:BakedSoftware/Si…
kayleg Jun 9, 2020
d07ab0c
v0.60.0-rc4
kayleg Jun 9, 2020
ca7c9a9
Merge pull request #27 from jdejesus007/bugfix/sio2-href
jdejesus007 Jun 13, 2020
e0e7a21
Fallback observer needs to use array syntax too
kayleg Jun 19, 2020
e4509d9
Version Bump
kayleg Jun 19, 2020
84ec203
Always flush data-include when processing
kayleg Jul 7, 2020
b99d76e
Merge branch 'feature/new-dom-updater' of https://github.com/BakedSof…
jdejesus007 Jul 13, 2020
3249cc1
Handle deregistered node
kayleg Jul 14, 2020
5fe2979
Fixed scroll finished. Disabled closure advanced optimizations
kayleg Jul 31, 2020
3637334
Prevent srcset from setting null
kayleg Jan 14, 2021
9429f8b
Fix copy/pasta error
kayleg Jan 14, 2021
b91a81d
Version Bump
kayleg Jan 14, 2021
6aaa12a
Merge remote-tracking branch 'kayle-silica/feature/new-dom-updater' i…
jdejesus007 Jan 17, 2021
7a375fe
Set empty srcset if null
jdejesus007 Jan 18, 2021
b8ceddf
Bumped version to 0.60.2
jdejesus007 Jan 18, 2021
9144706
Merge pull request #43 from jdejesus007/bugfix/srcset
kayleg Jan 18, 2021
73b0e34
Improved development server stability. Added option to disable gzip/b…
kayleg Jan 28, 2021
6e39a3c
Allow compile time data-includes to span multiple lines
kayleg Jan 28, 2021
17f8db9
Updated compile dependencies
kayleg Jan 28, 2021
1555eff
Add data-with to alias properties
kayleg Feb 4, 2021
e7e9e6b
Allow 'as' within variable name in data-with
kayleg Feb 5, 2021
a39c5dd
Lazy load src and srcset properties
kayleg Feb 9, 2021
39b0bb1
Remove img src if it is null instead of setting default
kayleg Feb 11, 2021
85c0352
Revert build setting for language out - it breaks everything
kayleg Feb 11, 2021
3e95dcd
Add ability to run trigger immediately
kayleg Apr 7, 2021
7563ede
Fixed logic for skipping animation frame
kayleg Apr 7, 2021
bfb9f06
fix(observer): make option type elements always visible
kayleg May 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "standard",
"extends": "prettier",
"parserOptions": {
"ecmaVersion": 6
},
"globals": {
"goog": true,
"Silica": true,
Expand Down
4 changes: 4 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Install Silica js library & save to package.json
yarn add silica
```

## CDN Provided by JSDELIVR

[![](https://data.jsdelivr.com/v1/package/npm/silica/badge)](https://www.jsdelivr.com/package/npm/silica)

Documentation can be found in the Wiki

https://github.com/BakedSoftware/silica/wiki/
30 changes: 24 additions & 6 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ childProcess.execSync('rm -rf build_cache/src/externs.js')

// childProcess.execSync("cp ./node_modules/xxhashjs/build/xxhash.min.js dist/silica.js");
// childProcess.execSync("cp ./node_modules/xxhashjs/build/xxhash.min.js dist/silica.min.js");
childProcess.execSync('cat libs/md5.min.js >> dist/silica.js')
childProcess.execSync('cat libs/md5.min.js >> dist/silica.min.js')

var flags = {
js: 'build_cache/**/*.js',
language_in: 'ECMASCRIPT6',
language_out: 'ECMASCRIPT5',
compilation_level: 'ADVANCED',
language_out: 'ECMASCRIPT6',
compilation_level: 'SIMPLE',
externs: 'src/externs.js',
generate_exports: 'true'
}
Expand All @@ -31,7 +29,7 @@ closureCompiler.run(function (exitCode, stdOut, stdErr) {
if (stdErr.length) {
console.error(stdErr)
}
fs.appendFileSync('dist/silica.min.js', '!function(){\n"use strict";\n' + stdOut + '}.call(window);')
fs.appendFileSync('dist/silica.min.js', '!function(){\n' + stdOut + '}.call(window);')
let compress = spawnSync('gzip', ['-k', 'dist/silica.min.js'], {
stdio: [0, 1, 2],
cwd: process.cwd()
Expand All @@ -42,6 +40,16 @@ closureCompiler.run(function (exitCode, stdOut, stdErr) {
} else {
console.log('Compression finished')
}
compress = spawnSync('brotli', ['-Z', 'dist/silica.min.js'], {
stdio: [0, 1, 2],
cwd: process.cwd()
})
if (compress.error) {
console.log('An error occurred during brotli compression')
console.error(compress.error)
} else {
console.log('Brotli Compression finished')
}
})

// Build debug version
Expand All @@ -55,7 +63,7 @@ closureCompiler.run(function (exitCode, stdOut, stdErr) {
if (stdErr.length) {
console.error(stdErr)
}
fs.appendFileSync('dist/silica.js', '!function(){\n"use strict";\n' + stdOut + '}.call(window);')
fs.appendFileSync('dist/silica.js', '!function(){\n' + stdOut + '}.call(window);')
console.log('Compressing results')
let compress = spawnSync('gzip', ['-k', 'dist/silica.js'], {
stdio: [0, 1, 2],
Expand All @@ -67,4 +75,14 @@ closureCompiler.run(function (exitCode, stdOut, stdErr) {
} else {
console.log('Compression finished')
}
compress = spawnSync('brotli', ['-Z', 'dist/silica.js'], {
stdio: [0, 1, 2],
cwd: process.cwd()
})
if (compress.error) {
console.log('An error occurred during brotli compression')
console.error(compress.error)
} else {
console.log('Brotli Compression finished')
}
})
2,280 changes: 905 additions & 1,375 deletions dist/silica.js

Large diffs are not rendered by default.

Binary file added dist/silica.js.br
Binary file not shown.
Binary file modified dist/silica.js.gz
Binary file not shown.
162 changes: 76 additions & 86 deletions dist/silica.min.js

Large diffs are not rendered by default.

Binary file added dist/silica.min.js.br
Binary file not shown.
Binary file modified dist/silica.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion example/include.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<h5>
{{selectedFont}}
</h5>
<a data-click="showPage2">Show Other Page</a>
<a data-on-click="showPage2">Show Other Page</a>
</div>
2 changes: 1 addition & 1 deletion example/include2.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div>
This is another included page
<br />
<a data-click="showFirstPage">Show First Page</a>
<a data-on-click="showFirstPage">Show First Page</a>
</div>
99 changes: 94 additions & 5 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,25 @@
<title>Silica Example</title>
</head>
<body>
<style>
[data-show] {
transition: opacity 1s;
opacity: 1;
}

.hidden {
opacity: 0 !important;
position: absolute !important;
z-index: -1;
pointer-events: none;
}
</style>
<div data-style="appStyle">
<h1>{{greeting}}</h1>
<input type="text" data-model="name" placeholder="Enter Your Name" />
<a data-href="linkToEmail">Send Email</a>

<form action="" data-submit="alertUser">
<form action="" data-on-submit="alertUser">
<input type="text" data-model="name">
<input type="email" data-model="email">
<select data-model="selectedFont" data-repeat="font in fonts">
Expand All @@ -19,6 +33,10 @@ <h1>{{greeting}}</h1>
<input type="submit" value="Submit" data-disabled="!canSubmit">
</form>

<h4>{{counter}}</h4>
<button data-on-click="increment">++</button>
<button data-on-click="decrement">--</button>

<ul data-repeat="user in users">
<li>
<h2>{{user.name}}</h2>
Expand All @@ -29,8 +47,12 @@ <h3>{{grade.name}}</h3>
<td>{{klass.name}}</td>
<td>
<ol data-repeat="grade in klass.grades">
<li data-silica='["id=Ex.indexTest(index)"]'
data-click="printGrade(grade, klass, user)">{{grade}}</li>
<li data-id="Ex.indexTest(index)"
data-on-click="printGrade(grade, klass, user)">
<a data-href="grade">
{{grade}}
</a>
</li>
</ol>
</td>
</tr>
Expand All @@ -46,11 +68,25 @@ <h3>{{grade.name}}</h3>

<h3>Embedded Page: {{embeddedPage}}</h3>
<div data-include="embeddedPage"></div>
<button data-show="!runUpdates" data-on-click="startTimer">Start Timer</button>
<button data-show="runUpdates" data-on-click="stopTimer">Stop Timer</button>
<ul data-repeat="item in largeList" data-repeat-not-nested="true" >
<li>{{item.value|duration}}</li>
</ul>
</div>
<script src="../dist/silica.js" type="text/javascript" charset="utf-8"></script>
<script src="../dist/silica.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
(function(){
'use strict';
class ListItem {
constructor (app) {
this.created = new Date()
this._app = app
}
get value () {
return this._app.now - this.created
}
}
window.Ex = {
AppCntrl: class AppCntrl extends Silica.Controllers.Base {
constructor(el) {
Expand All @@ -62,6 +98,12 @@ <h3>Embedded Page: {{embeddedPage}}</h3>
name:"Old Typey"}, {key:"Operator Mono", name:"Best"}];
this.selectedFont = "Courier";
this.states = { "FL": "Florida", "CA": "California"};
this.largeList = [];
this.now = new Date()
this.counter = 0
for (let i = 0; i < 10; i++) {
this.largeList.push(new ListItem(this))
}
this.users = [
{
name: "Alice",
Expand Down Expand Up @@ -117,6 +159,10 @@ <h3>Embedded Page: {{embeddedPage}}</h3>
];
}

linkToEmail () {
return `mailto:${this.email}`
}

canSubmit() {
return this.name && this.name.length > 0;
}
Expand All @@ -142,11 +188,46 @@ <h3>Embedded Page: {{embeddedPage}}</h3>
showPage2(){
this.embeddedPage = "./include2.html";
}

getRandomInt (min, max) {
min = Math.ceil(min)
max = Math.floor(max)
return Math.floor(Math.random() * (max - min + 1)) + min
}

continuouslyUpdate () {
if (this.runUpdates) {
requestAnimationFrame(() => {
Silica.apply(() => {
this.now = new Date()
this.continuouslyUpdate()
})
})
}
}

startTimer () {
this.runUpdates = true
this.continuouslyUpdate()
}

stopTimer () {
this.runUpdates = false
}

increment () {
this.counter++
}

decrement () {
this.counter--
}
},

indexTest(index) {
return "Prefix-Test-" + index;
}

};
Ex.AppCntrl.watchers = {
"characters.length": function(current, previous) {
Expand All @@ -169,9 +250,17 @@ <h3>Embedded Page: {{embeddedPage}}</h3>
var ct = class TestCntrl extends Silica.Controllers.Base {
onClick(){Silica.goTo("/something"); }
};
Silica.addFilter('duration', (milis) => {
let sec = (milis / 1000) | 0
let min = (sec / 60) | 0
sec = sec % 60
let h = (min / 60) | 0
min = min % 60
return (h > 0 ? h + ':' : '') + `${('0'+min).substr(-2)}:${('0'+sec).substr(-2)}`
})
Silica.usePushState = false;
Silica.addDirective("my-element", {
template: "<div data-click='onClick'>this is my custom element</div>",
template: "<div data-on-click='onClick'>this is my custom element</div>",
controller: ct });
Silica.setContext("Ex");
Silica.setRouter(new Ex.Router);
Expand Down
10 changes: 0 additions & 10 deletions libs/md5.min.js

This file was deleted.

47 changes: 26 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,51 @@
{
"name": "silica",
"version": "0.52.0",
"version": "0.65.1",
"description": "Silica is a fast lightweight javascript framework for building applications. Silica's usage is designed to be as transparent as possible",
"bin": {
"silica": "src/cli/silica-cli.js"
"silica": "src/cli/silica-cli.js",
"silica-create": "src/cli/silica-create.js",
"silica-build": "src/cli/silica-build.js",
"silica-watch": "src/cli/silica-watch.js",
"silica-test": "src/cli/silica-test.js"
},
"dependencies": {
"colors": ">=0.6.0",
"commander": "^2.15.1",
"csso": "^3.5.0",
"eslint": "^4.19.1",
"eslint-config-standard": "^11.0.0",
"csso": "^4.2.0",
"eslint": "^7.2",
"finalhandler": "^1.1.1",
"fs-extra": "^5.0.0",
"glob": "^7.1.3",
"google-closure-compiler": "20180402.0.0",
"livereload": "^0.7.0",
"nib": "^1.1.2",
"node-sprite-generator": "^0.10.2",
"node-static": "^0.7.10",
"npm": "^5.8.0",
"stylus": "^0.54.0",
"fs-extra": "^8.1",
"glob": "^7.1",
"google-closure-compiler": "20210106.0.0",
"livereload": "^0.9.0",
"nib": "stylus/nib#8291e5d20e400e04892a0b1261e2a81773d07fb4",
"node-sprite-generator": "selaux/node-sprite-generator#0a794ba1d73739693b559f4e42354a51fb84d6c8",
"node-static": "^0.7.11",
"npm": "^6.14.0",
"stylus": "^0.54.8",
"watch": "^1.0.2"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"build": "node build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/BakedSoftware/silica.git"
},
"author": "Kayle Gishen",
"license": "GPL-3.0",
"jsdelivr": "/dist/silica.min.js",
"bugs": {
"url": "https://github.com/BakedSoftware/Silica/issues"
},
"homepage": "https://github.com/BakedSoftware/Silica#readme",
"standard": {
"globals": [
"Silica",
"goog",
"md5",
"XMLHttpRequest"
]
"globals": ["Silica", "goog", "XMLHttpRequest"]
},
"devDependencies": {
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-import": "^2.22.1"
}
}
Loading