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 (5)
<a name="v3.23.0"></a>
## [v3.23.0] - 2023-03-07
### Add Features
- template mapping
### Bug Fixes
- rebuild template insert hack
<a name="v3.22.1"></a>
## [v3.22.1] - 2023-03-07
### Bug Fixes
......@@ -389,6 +398,7 @@
<a name="1.8.0"></a>
## 1.8.0 - 2021-08-15
[v3.23.0]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.22.1...v3.23.0
[v3.22.1]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.22.0...v3.22.1
[v3.22.0]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.21.1...v3.22.0
[v3.21.1]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.21.0...v3.21.1
......
{
"name": "@schukai/monster",
"version": "3.22.0",
"version": "3.22.1",
"description": "Monster is a simple library for creating fast, robust and lightweight websites.",
"keywords": [
"framework",
......
......@@ -16,7 +16,6 @@ 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,
......@@ -143,14 +142,6 @@ 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}
......
......@@ -267,6 +267,7 @@ class CustomElement extends HTMLElement {
* @property {Boolean} delegatesFocus=true A boolean that, when set to true, specifies behavior that mitigates custom element issues around focusability. When a non-focusable part of the shadow DOM is clicked, the first focusable part is given focus, and the shadow host is given any available :focus styling.
* @property {Object} templates Templates
* @property {string} templates.main=undefined Main template
* @property {Object} templateMapping Template mapping
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow
* @since 1.8.0
......@@ -279,6 +280,7 @@ class CustomElement extends HTMLElement {
templates: {
main: undefined,
},
templateMapping: {},
};
}
......@@ -398,7 +400,8 @@ class CustomElement extends HTMLElement {
try {
value = new Pathfinder(this[internalSymbol].getRealSubject()["options"]).getVia(path);
} catch (e) {}
} catch (e) {
}
if (value === undefined) return defaultValue;
return value;
......@@ -468,7 +471,8 @@ class CustomElement extends HTMLElement {
try {
initShadowRoot.call(self);
elements = self.shadowRoot.childNodes;
} catch (e) {}
} catch (e) {
}
try {
initCSSStylesheet.call(this);
......@@ -519,7 +523,8 @@ class CustomElement extends HTMLElement {
* @return {void}
* @since 1.7.0
*/
disconnectedCallback() {}
disconnectedCallback() {
}
/**
* The custom element has been moved into a new document (e.g. someone called document.adoptNode(el)).
......@@ -527,7 +532,8 @@ class CustomElement extends HTMLElement {
* @return {void}
* @since 1.7.0
*/
adoptedCallback() {}
adoptedCallback() {
}
/**
* Called when an observed attribute has been added, removed, updated, or replaced. Also called for initial
......@@ -816,7 +822,8 @@ function parseOptionsJSON(data) {
try {
let dataUrl = parseDataURL(data);
data = dataUrl.content;
} catch (e) {}
} catch (e) {
}
try {
obj = JSON.parse(data);
......@@ -838,6 +845,11 @@ function initHtmlContent() {
} catch (e) {
let html = this.getOption("templates.main", "");
if (isString(html) && html.length > 0) {
const mapping = this.getOption("templateMapping", {});
if (isObject(mapping)) {
html = new Formatter(mapping).format(html);
}
this.innerHTML = html;
}
}
......
......@@ -17,8 +17,7 @@ import {
ATTRIBUTE_UPDATER_INSERT_REFERENCE,
ATTRIBUTE_UPDATER_REMOVE,
ATTRIBUTE_UPDATER_REPLACE,
ATTRIBUTE_UPDATER_SELECT_THIS,
ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID
ATTRIBUTE_UPDATER_SELECT_THIS
} from "../dom/constants.mjs";
import {Base} from "../types/base.mjs";
......@@ -514,50 +513,6 @@ function insertElement(change) {
}
}
/**
* @private
* @param container
* @param key
* @param ref
* @param path
* @returns {any}
*/
function internalTemplateLookUp(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;
}
}
const rootNode = container.getRootNode();
if (rootNode instanceof ShadowRoot) {
const host = rootNode?.host;
if (host && host.hasAttribute(ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID)) {
templateID = host.getAttribute(ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID);
template = findDocumentTemplate(templateID, container);
if (template instanceof HTMLTemplateElement) {
return template;
}
}
}
return findDocumentTemplate(templateID, container);
}
/**
*
* @private
......@@ -570,8 +525,7 @@ function internalTemplateLookUp(container, key, ref, path) {
* @throws {Error} no template was found with the specified key.
*/
function appendNewDocumentFragment(container, key, ref, path) {
let template = internalTemplateLookUp(container, key, ref, path);
let template = findDocumentTemplate(key, container);
let nodes = template.createDocumentFragment();
for (const [, node] of Object.entries(nodes.childNodes)) {
......
......@@ -142,7 +142,7 @@ function getMonsterVersion() {
}
/** don't touch, replaced by make with package.json version */
monsterVersion = new Version("3.22.0");
monsterVersion = new Version("3.22.1");
return monsterVersion;
}
{
"name": "monster",
"version": "3.22.0",
"version": "3.22.1",
"description": "monster",
"repository": {
"type": "git",
......
......@@ -3,11 +3,11 @@
<head>
<script type="module" src="main.mjs"></script>
</head>
<body data-monster-insert-template-id="bla">
<body>
<h1>Updater</h1>
<template id="bla">
<template id="current">
<li data-monster-replace="path:current | index:j"></li>
</template>
<div id="test1">
......
......@@ -46,14 +46,14 @@ function createStyleSheetPlugin() {
return {
name: 'buildStart',
buildStart() {
console.log('buildStart')
exec('pnpm run -C ' + scriptDir + " build-style", (err, stdout, stderr) => {
if (err) {
//some err occurred
console.error(err)
}
});
// console.log('buildStart')
//
// exec('pnpm run -C ' + scriptDir + " build-style", (err, stdout, stderr) => {
// if (err) {
// //some err occurred
// console.error(err)
// }
// });
},
async transform(raw, id, options) {
......
......@@ -7,7 +7,7 @@ describe('Monster', function () {
let monsterVersion
/** don´t touch, replaced by make with package.json version */
monsterVersion = new Version("3.22.0")
monsterVersion = new Version("3.22.1")
let m = getMonsterVersion();
......
{"version":"3.22.1"}
{"version":"3.23.0"}