-
+
diff --git a/src/components/widgets/ubg-cards.js b/src/components/widgets/ubg-cards.js
index 3053f7c69..174c62984 100644
--- a/src/components/widgets/ubg-cards.js
+++ b/src/components/widgets/ubg-cards.js
@@ -239,188 +239,12 @@ ${mainElements}`, bounds);
}
-const hedronSVG = do {
- function point(pt) {
- return `${pt.x} ${pt.y}`;
- }
-
- const topB = lively.pt(11.5, 14.401);
- const topL = topB.addXY(-11.5, -4.758);
- const topT = topL.addXY(11.5, -9.66);
- const topR = topT.addXY(11.5, 9.66);
- const topB2 = topR.addXY(-11.5, 4.758);
- const topLeftData = `M${point(topB)} L ${point(topL)} ${point(topT)} z`;
- const topRightData = `M${point(topB)} L ${point(topT)} ${point(topR)} z`;
-
- const bottomB = lively.pt(11.5, 16.036);
- const bottomL = bottomB.addXY(-11.5, -5.050);
- const bottomT = bottomL.addXY(11.5, 12.030);
- const bottomR = bottomT.addXY(11.5, -12.030);
- const bottomB2 = bottomR.addXY(-11.5, 5.050);
- const bottomLeftData = `M${point(bottomB)} L ${point(bottomL)} ${point(bottomT)} z`;
- const bottomRightData = `M${point(bottomB)} L ${point(bottomT)} ${point(bottomR)} ${point(bottomB2)} z`;
-
- const greenHedron = true;
-
;
-};
-
-{
- const hedronTemp = document.getElementById('hedron')
+function previewSVG(svg) {
+ const hedronTemp = document.getElementById(svg.id)
if (hedronTemp) {
hedronTemp.remove()
}
- document.body.insertAdjacentHTML("afterbegin", hedronSVG.outerHTML)
-}
-
-const upgradeSVG = do {
- const svg = (
);
-svg
-};
-
-{
- const hedronTemp = document.getElementById('upgradeSVG')
- if (hedronTemp) {
- hedronTemp.remove()
- }
- document.body.insertAdjacentHTML("afterbegin", upgradeSVG.outerHTML)
+ document.body.insertAdjacentHTML("afterbegin", svg.outerHTML)
}
@@ -428,118 +252,6 @@ function rectToViewBox(rect) {
return `${rect.x} ${rect.y} ${rect.width} ${rect.height}`
}
-const TAP_VIEWBOX = lively.rect(2 ,20 ,103 ,103);
-const tapSVG = do {
- function toPair(pt) {
- return `${pt.x} ${pt.y}`
- }
-
- const size = 18
- const tip = lively.pt(83.5, 65)
- const anchor = tip.subY(size);
- const tail = anchor.subXY(20, 25)
- const tipLeft = tip.subXY(size, size)
- const tipRight = tip.addXY(size, -size)
- const anchorLeft = tipLeft.addX(12.5)
- const anchorRight = tipRight.subX(12.5)
- const controlLeft = anchorLeft.subY(18)
- const controlRight = anchorRight.subY(18)
- const controlTail = tail.addX(5)
- const path =
-;
- const C_BACKCARD_FILL = "transparent";
- const C_BACKCARD_STROKE = "black";
- const C_FRONTCARD_FILL = "black";
- const C_FRONTCARD_STROKE = "black";
-
- const svg = (
);
-svg
-};
-
-{
- const hedronTemp = document.getElementById('tap-icon-ubg')
- if (hedronTemp) {
- hedronTemp.remove()
- }
- document.body.insertAdjacentHTML("afterbegin", tapSVG.outerHTML)
-}
-
-
-
-
-const tradeSVG = do {
- const path1 = "M19.335 11.943c1.463 0.801 2.775 2.074 4.369 4.148 0.005-0.056 0.010-0.113 0.016-0.171 0.309-3.338 0.912-9.84-9.249-13.17 0.113 0.146 0.508 0.575 0.958 1.064 0.75 0.815 1.651 1.795 1.651 1.901-0.903-0.529-5.419-1.906-9.333 0.847s-5.189 6.67-4.616 11.329c0.455 3.7 3.289 6.799 6.95 8.289-2.584-1.464-4.341-4.342-4.341-7.654 0-4.795 3.684-8.682 8.229-8.682 2.050 0 3.925 0.791 5.366 2.099z";
- const path2 = "M12.665 20.057c-1.463-0.801-2.775-2.074-4.369-4.148-0.005 0.056-0.010 0.113-0.016 0.171-0.309 3.338-0.912 9.839 9.249 13.17-0.113-0.145-0.508-0.575-0.958-1.064-0.75-0.815-1.651-1.795-1.651-1.901 0.903 0.529 5.419 1.906 9.333-0.847s5.189-6.67 4.616-11.329c-0.454-3.7-3.289-6.799-6.95-8.289 2.584 1.464 4.341 4.342 4.341 7.654 0 4.795-3.684 8.682-8.229 8.682-2.050 0-3.925-0.791-5.366-2.099z";
- const svg = (
);
-svg
-};
-
-{
- const hedronTemp = document.getElementById('tradeSVG')
- if (hedronTemp) {
- hedronTemp.remove()
- }
- document.body.insertAdjacentHTML("afterbegin", tradeSVG.outerHTML)
-}
-
-const CARD_COST_ONE_VIEWBOX = lively.rect(0, 0, 270, 270);
-const cardCostOneSVG = do {
- '#d3d3d3'
- const C_OUTER = '#252525'
- const C_INNER = '#d1d1d1'
- const C_TOP = '#e1e5e4'
- const C_IMAGE = '#f4f4f4'
-
- const outer = lively.rect(0, 0, 190, 270)
- const inner = outer.insetBy(15)
- const top = inner.insetBy(10)
- const image = top.insetByRect(lively.rect(0, 30, 0, 45))
- const svg = (
-
-);
-svg
-};
-
-{
- const hedronTemp = document.getElementById('cardCostOneSVG')
- if (hedronTemp) {
- hedronTemp.remove()
- }
- document.body.insertAdjacentHTML("afterbegin", cardCostOneSVG.outerHTML)
-}
const CARD_COST_VIEWBOX = lively.rect(0, 0, 376, 326);
const cardCostTwoSVG = do {
@@ -561,13 +273,7 @@ const cardCostTwoSVG = do {
svg
};
-{
- const hedronTemp = document.getElementById('cardCostTwoSVG')
- if (hedronTemp) {
- hedronTemp.remove()
- }
- document.body.insertAdjacentHTML("afterbegin", cardCostTwoSVG.outerHTML)
-}
+// previewSVG(cardCostTwoSVG)
class FileCache {
@@ -699,10 +405,35 @@ export default class Cards extends Morph {
});
}
+ functionForFilter(filter) {
+ if (filter.startsWith('>')) {
+ let functionBody = `return !!(${filter.substring(1).trim()})`;
+ return new Function('c', functionBody);
+ }
+
+ filter = filter.toLowerCase();
+ const regex = new RegExp(filter, 'gmi')
+
+ return function filterFunction(card) {
+ const id = card.getId();
+ const name = card.getName();
+ const cardType = card.getType()
+ const element = card.getElement();
+ const cost = card.getCost();
+ const text = card.getText();
+ const notes = card.getNotes();
+ const tags = card.getTags().join(' ');
+
+ const aspects = [id, name, cardType, element, cost, text, notes, tags];
+ return aspects.some(aspect => (aspect + '').toLowerCase().match(regex));
+ }
+ }
+
updateItemsToFilter() {
const filterValue = this.filterValue;
+ const filterFunction = this.functionForFilter(filterValue);
this.allEntries.forEach(entry => {
- entry.updateToFilter(filterValue);
+ entry.updateToFilter(filterFunction);
});
}
@@ -886,7 +617,7 @@ export default class Cards extends Morph {
return;
}
- if (evt.ctrlKey && !evt.repeat && evt.key == "/") {
+ if (evt.ctrlKey && !evt.repeat && ['f', '/'].includes(evt.key)) {
evt.stopPropagation();
evt.preventDefault();
@@ -1038,7 +769,10 @@ export default class Cards extends Morph {
tagCount.set(tag, (tagCount.get(tag) || 0) + 1);
})
})
- this._allTags = [...tagCount.entries()].sortBy('second', false).map(pair => pair.first);
+ this._allTags = [...tagCount.entries()].sortBy('first', true).map(pair => ({
+ value: pair.first,
+ string: `${pair.first} (${pair.second})`
+ }));
}
return this._allTags
}
diff --git a/src/external/code-mirror/addon/hint/show-hint.js b/src/external/code-mirror/addon/hint/show-hint.js
index aaf1f643f..a0aaf5541 100644
--- a/src/external/code-mirror/addon/hint/show-hint.js
+++ b/src/external/code-mirror/addon/hint/show-hint.js
@@ -258,22 +258,36 @@
var pos = cm.cursorCoords(completion.options.alignWithWord ? data.from : null);
var left = pos.left, top = pos.bottom, below = true;
var offsetLeft = 0, offsetTop = 0;
+
+ // BEGIN #Lively #Hack because new CodeMirror version....
if (container !== ownerDocument.body) {
+
+
// We offset the cursor position because left and top are relative to the offsetParent's top left corner.
- var isContainerPositioned = ['absolute', 'relative', 'fixed'].indexOf(parentWindow.getComputedStyle(container).position) !== -1;
- var offsetParent = isContainerPositioned ? container : container.offsetParent;
- var offsetParentPosition = offsetParent.getBoundingClientRect();
- var bodyPosition = ownerDocument.body.getBoundingClientRect();
- offsetLeft = (offsetParentPosition.left - bodyPosition.left - offsetParent.scrollLeft);
- offsetTop = (offsetParentPosition.top - bodyPosition.top - offsetParent.scrollTop);
+
+ // var isContainerPositioned = ['absolute', 'relative', 'fixed'].indexOf(parentWindow.getComputedStyle(container).position) !== -1;
+ // var offsetParent = isContainerPositioned ? container : container.offsetParent;
+ // var offsetParentPosition = offsetParent.getBoundingClientRect();
+ // var bodyPosition = ownerDocument.body.getBoundingClientRect();
+ // offsetLeft = (offsetParentPosition.left - bodyPosition.left - offsetParent.scrollLeft);
+ // offsetTop = (offsetParentPosition.top - bodyPosition.top - offsetParent.scrollTop);
}
- hints.style.left = (left - offsetLeft) + "px";
- hints.style.top = (top - offsetTop) + "px";
+
+
+ offsetLeft = -document.scrollingElement.scrollLeft;
+ offsetTop = -document.scrollingElement.scrollTop;
+
+ container.appendChild(hints);
+ lively.setClientPosition(hints, lively.pt(left + offsetLeft, top + offsetTop))
+
+ // hints.style.left = (left - offsetLeft) + "px";
+ // hints.style.top = (top - offsetTop) + "px";
+ // END #Lively #Hack #Lukas was here too (#Jens)
+
// If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
var winW = parentWindow.innerWidth || Math.max(ownerDocument.body.offsetWidth, ownerDocument.documentElement.offsetWidth);
var winH = parentWindow.innerHeight || Math.max(ownerDocument.body.offsetHeight, ownerDocument.documentElement.offsetHeight);
- container.appendChild(hints);
cm.getInputField().setAttribute("aria-autocomplete", "list")
cm.getInputField().setAttribute("aria-owns", this.id)
cm.getInputField().setAttribute("aria-activedescendant", this.id + "-" + this.selectedHint)
diff --git a/src/plugin-babel.js b/src/plugin-babel.js
index eb3167ce5..7388df95f 100644
--- a/src/plugin-babel.js
+++ b/src/plugin-babel.js
@@ -417,13 +417,11 @@ async function aexprViaDirectivePlugins(options = {}) {
await importDefaultOf('babel-plugin-syntax-async-generators'),
await importDefaultOf('babel-plugin-syntax-object-rest-spread'),
await importDefaultOf('babel-plugin-syntax-class-properties'),
+ await importDefaultOf('babel-plugin-sample-data-bindings'),
await importDefaultOf('babel-plugin-var-recorder'),
[await importDefaultOf('babel-plugin-ILA'), {
executedIn: 'file'
}],
- [await importDefaultOf('babel-plugin-sample-data-bindings'), {
- executedIn: 'file'
- }],
[await importDefaultOf('babel-plugin-databindings'), {
executedIn: 'file'
}],
@@ -492,17 +490,19 @@ async function workspacePlugins(options = {}) {
])
+ const enableAExprsInWorkspace = localStorage.getItem("DisableAExpWorkspace") !== "true";
+ if (enableAExprsInWorkspace) {
+ result.push(await importDefaultOf('babel-plugin-sample-data-bindings'))
+ }
+
result.push(...await doitPlugins())
result.push(await importDefaultOf('babel-plugin-var-recorder'))
- if (localStorage.getItem("DisableAExpWorkspace") !== "true") {
+ if (enableAExprsInWorkspace) {
result.push([await importDefaultOf('babel-plugin-ILA'), {
executedIn: 'file'
}])
- result.push([await importDefaultOf('babel-plugin-sample-data-bindings'), {
- executedIn: 'file'
- }])
result.push([await importDefaultOf('babel-plugin-databindings'), {
executedIn: 'file'
}])