Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 1.31
  • master
  • 1.10.0
  • 1.30.1
  • 1.31.0
  • 1.8.0
  • 1.9.0
  • 3.100.0
  • 3.100.1
  • 3.100.10
  • 3.100.11
  • 3.100.12
  • 3.100.13
  • 3.100.14
  • 3.100.15
  • 3.100.16
  • 3.100.17
  • 3.100.18
  • 3.100.19
  • 3.100.2
  • 3.100.20
  • 3.100.3
  • 3.100.4
  • 3.100.5
  • 3.100.6
  • 3.100.7
  • 3.100.8
  • 3.100.9
  • 3.101.0
  • 3.101.1
  • 3.101.2
  • 3.101.3
  • 3.102.0
  • 3.102.1
  • 3.102.2
  • 3.102.3
  • 3.102.4
  • 3.102.5
  • 3.102.6
  • 3.103.0
  • 3.103.1
  • 3.104.0
  • 3.104.1
  • 3.105.0
  • 3.105.1
  • 3.105.2
  • 3.106.0
  • 3.106.1
  • 3.107.0
  • 3.108.0
  • 3.108.1
  • 3.108.2
  • 3.108.3
  • 3.108.4
  • 3.108.5
  • 3.109.0
  • 3.110.0
  • 3.110.1
  • 3.110.2
  • 3.110.3
  • 3.110.4
  • 3.111.0
  • 3.112.0
  • 3.112.1
  • 3.112.2
  • 3.112.3
  • 3.112.4
  • 3.113.0
  • 3.114.0
  • 3.114.1
  • 3.114.2
  • 3.114.3
  • 3.114.4
  • 3.114.5
  • 3.114.6
  • 3.114.7
  • 3.115.0
  • 3.115.1
  • 3.115.2
  • 3.115.3
  • 3.115.4
  • 3.116.0
  • 3.116.1
  • 3.117.0
  • 3.117.1
  • 3.117.2
  • 3.117.3
  • 3.118.0
  • 3.118.1
  • 3.119.0
  • 3.120.0
  • 3.121.0
  • 3.51.5
  • 3.52.0
  • 3.52.1
  • 3.53.0
  • 3.54.0
  • 3.55.0
  • 3.55.1
  • 3.55.2
  • 3.55.3
  • 3.55.4
102 results

Target

Select target project
  • oss/libraries/javascript/monster
1 result
Select Git revision
  • 1.31
  • master
  • 1.10.0
  • 1.30.1
  • 1.31.0
  • 1.8.0
  • 1.9.0
  • 3.100.0
  • 3.100.1
  • 3.100.10
  • 3.100.11
  • 3.100.12
  • 3.100.13
  • 3.100.14
  • 3.100.15
  • 3.100.16
  • 3.100.17
  • 3.100.18
  • 3.100.19
  • 3.100.2
  • 3.100.20
  • 3.100.3
  • 3.100.4
  • 3.100.5
  • 3.100.6
  • 3.100.7
  • 3.100.8
  • 3.100.9
  • 3.101.0
  • 3.101.1
  • 3.101.2
  • 3.101.3
  • 3.102.0
  • 3.102.1
  • 3.102.2
  • 3.102.3
  • 3.102.4
  • 3.102.5
  • 3.102.6
  • 3.103.0
  • 3.103.1
  • 3.104.0
  • 3.104.1
  • 3.105.0
  • 3.105.1
  • 3.105.2
  • 3.106.0
  • 3.106.1
  • 3.107.0
  • 3.108.0
  • 3.108.1
  • 3.108.2
  • 3.108.3
  • 3.108.4
  • 3.108.5
  • 3.109.0
  • 3.110.0
  • 3.110.1
  • 3.110.2
  • 3.110.3
  • 3.110.4
  • 3.111.0
  • 3.112.0
  • 3.112.1
  • 3.112.2
  • 3.112.3
  • 3.112.4
  • 3.113.0
  • 3.114.0
  • 3.114.1
  • 3.114.2
  • 3.114.3
  • 3.114.4
  • 3.114.5
  • 3.114.6
  • 3.114.7
  • 3.115.0
  • 3.115.1
  • 3.115.2
  • 3.115.3
  • 3.115.4
  • 3.116.0
  • 3.116.1
  • 3.117.0
  • 3.117.1
  • 3.117.2
  • 3.117.3
  • 3.118.0
  • 3.118.1
  • 3.119.0
  • 3.120.0
  • 3.121.0
  • 3.51.5
  • 3.52.0
  • 3.52.1
  • 3.53.0
  • 3.54.0
  • 3.55.0
  • 3.55.1
  • 3.55.2
  • 3.55.3
  • 3.55.4
102 results
Show changes
Commits on Source (4)
<a name="v3.21.0"></a>
## [v3.21.0] - 2023-03-07
### Add Features
- new Template ID for insert
<a name="v3.20.0"></a>
## [v3.20.0] - 2023-03-01
### Add Features
......@@ -362,6 +368,7 @@
<a name="1.8.0"></a>
## 1.8.0 - 2021-08-15
[v3.21.0]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.20.0...v3.21.0
[v3.20.0]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.19.0...v3.20.0
[v3.19.0]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.18.0...v3.19.0
[v3.18.0]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.17.0...v3.18.0
......
{
"name": "@schukai/monster",
"version": "3.19.0",
"version": "3.20.0",
"description": "Monster is a simple library for creating fast, robust and lightweight websites.",
"keywords": [
"framework",
......
......@@ -16,6 +16,7 @@ export {
ATTRIBUTE_UPDATER_SELECT_THIS,
ATTRIBUTE_UPDATER_REPLACE,
ATTRIBUTE_UPDATER_INSERT,
ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID,
ATTRIBUTE_UPDATER_INSERT_REFERENCE,
ATTRIBUTE_UPDATER_REMOVE,
ATTRIBUTE_UPDATER_BIND,
......@@ -142,6 +143,14 @@ const ATTRIBUTE_UPDATER_REPLACE = `${ATTRIBUTE_PREFIX}replace`;
*/
const ATTRIBUTE_UPDATER_INSERT = `${ATTRIBUTE_PREFIX}insert`;
/**
* @memberOf Monster.DOM
* @type {string}
* @license AGPLv3
* @since 3.21.0
*/
const ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID = `${ATTRIBUTE_UPDATER_INSERT}-template-id`;
/**
* @memberOf Monster.DOM
* @type {string}
......
......@@ -18,7 +18,7 @@ import {
ATTRIBUTE_UPDATER_REMOVE,
ATTRIBUTE_UPDATER_REPLACE,
ATTRIBUTE_UPDATER_SELECT_THIS,
customElementUpdaterLinkSymbol,
ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID
} from "../dom/constants.mjs";
import {Base} from "../types/base.mjs";
......@@ -31,7 +31,6 @@ import { trimSpaces } from "../util/trimspaces.mjs";
import {addToObjectLink} from "./attributes.mjs";
import {findTargetElementFromEvent} from "./events.mjs";
import {findDocumentTemplate} from "./template.mjs";
import { getDocument } from "./util.mjs";
export {Updater, addObjectWithUpdaterToElement};
......@@ -400,7 +399,6 @@ function removeElement(change) {
function insertElement(change) {
const self = this;
const subject = self[internalSymbol].subject.getRealSubject();
const document = getDocument();
let mem = new WeakSet();
let wd = 0;
......@@ -516,6 +514,30 @@ function insertElement(change) {
}
}
function findTemplate(container, key, ref, path) {
let templateID = key;
let template;
if (container.hasAttribute(ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID)) {
templateID = container.getAttribute(ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID);
template = findDocumentTemplate(templateID, container);
if (template instanceof HTMLTemplateElement) {
return template;
}
}
if (container.closest(`[${ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID}]`)) {
templateID = container.closest(`[${ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID}]`).getAttribute(ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID);
template = findDocumentTemplate(templateID, container);
if (template instanceof HTMLTemplateElement) {
return template;
}
}
return findDocumentTemplate(templateID, container);
}
/**
*
* @private
......@@ -528,8 +550,9 @@ function insertElement(change) {
* @throws {Error} no template was found with the specified key.
*/
function appendNewDocumentFragment(container, key, ref, path) {
let template = findDocumentTemplate(key, container);
let template = findTemplate(container, key, ref, path);
console.log(template);
let nodes = template.createDocumentFragment();
for (const [, node] of Object.entries(nodes.childNodes)) {
if (node instanceof HTMLElement) {
......
......@@ -142,7 +142,7 @@ function getMonsterVersion() {
}
/** don't touch, replaced by make with package.json version */
monsterVersion = new Version("3.19.0");
monsterVersion = new Version("3.20.0");
return monsterVersion;
}
{
"name": "monster",
"version": "3.19.0",
"version": "3.20.0",
"description": "monster",
"repository": {
"type": "git",
......
<!DOCTYPE html>
<html lang="en">
<head>
<script type="module" src="main.mjs"></script>
</head>
<body data-monster-insert-template-id="bla">
<h1>Updater</h1>
<template id="bla">
<li data-monster-replace="path:current | index:j"></li>
</template>
<div id="test1">
<ul data-monster-insert="current path:a.b" >
</ul>
</div>
</body>
</html>
import {Updater} from '../../../application/source/dom/updater.mjs';
let element = document.getElementById('test1')
let d = new Updater(
element,
{
a: {
b: [
{
i: '0',
j: 'hello'
},
]
}
}
);
d.run().then(() => {
console.log('done');
});
......@@ -18,7 +18,7 @@ import {directoryPlugin} from "vite-plugin-list-directory-contents";
import mkcert from 'vite-plugin-mkcert'
import {ViteMinifyPlugin} from 'vite-plugin-minify'
import glob from 'glob'
import {globSync} from 'glob'
import {exec} from "child_process";
......@@ -28,7 +28,7 @@ const source = resolve(__dirname, '')
const dist = resolve(__dirname, '')
glob.sync(source + '/**/*.html', {
globSync(source + '/**/*.html', {
ignore: [
'**/resource/**'
]
......
......@@ -7,7 +7,7 @@ describe('Monster', function () {
let monsterVersion
/** don´t touch, replaced by make with package.json version */
monsterVersion = new Version("3.19.0")
monsterVersion = new Version("3.20.0")
let m = getMonsterVersion();
......
{"version":"3.20.0"}
{"version":"3.21.0"}