Skip to content

Commit cd76d67

Browse files
committed
Merge branch 'gh-pages' of https://github.com/LivelyKernel/lively4-core into gh-pages
2 parents ca825ed + 4bd8e01 commit cd76d67

File tree

25 files changed

+322
-240
lines changed

25 files changed

+322
-240
lines changed

demos/contraints/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# #EUD20 Lively Contraints
1+
# #EUD20 Lively Constraints

doc/journal/2020-09-01.md/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var lastWindow;
2525
})()
2626
```
2727

28-
## Turning Wiki-pages into Tools (#PaperIdea)
28+
## Turning Wiki-pages into Tools ( #PaperIdea )
2929

3030
We used markdown pages to prototype tools and visualizations a lot. But to use it, one had to navigate to that specific page and interact with the tool there. A good and working example of the setup are these journal pages and their index page that allows to create new entries. But markdown pages are not easy to integrate into a workflow with other tools. E.g. using the git graph visualization tool directly from our sync tools is not possible.
3131

src/client/fetch.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ export async function installAuthorizedFetch() {
140140
}
141141
}
142142

143-
if (isWriting && baseUrlsAuthNeededForWriting.find(ea => url.startsWith(ea))) {
143+
if (isWriting && baseUrlsAuthNeededForWriting.find(
144+
ea => url.startsWith(ea) && !url.startsWith(lively4url + "/.transpiled/") )) {
144145
return {
145146
result: (async () => {
146147
console.log("AuthorizedFetch Write: " + url)

src/client/morphic/selecting.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,26 +109,40 @@ export default class Selecting {
109109
// lively.showElement(e.composedPath()[0],1300).textContent = "path: " + e.composedPath().map(ea => ea.tagName).join(",")
110110

111111

112-
var rootNode = this.findRootNode(document.body)
113112

114113
var path = this.slicePathIfContainerContent(e.composedPath());
115114

116-
// var rootNode = lively.findWorldContext(path)
117115

118116
// workaround weird toplevel event issues... the halo should not get the event
119117
// lively.notify("path " + e.composedPath().map(ea => ea.tagName))
120118
if (e.composedPath().find(ea => ea.tagName == "LIVELY-HALO")) {
121119
path = this.lastPath || e.composedPath()
122120
}
121+
122+
// some inception: deal with containers that should behave as if they are their own document
123+
// if we have found one, treat them as root
124+
var worldContexts = path
125+
.map(ea => lively.findWorldContext(ea))
126+
.filter(ea => ea)
127+
.filter(ea => ea.id == "container-root")
128+
if (worldContexts.length > 0) {
129+
var rootNode = this.findRootNode(worldContexts[0])
130+
} else {
131+
rootNode = this.findRootNode(document.body)
132+
}
133+
123134
this.lastPath = path
124135
path = path
125136
// .reverse()
126137
.filter(ea => ! this.isIgnoredOnMagnify(ea))
127138

139+
140+
128141
if (e.shiftKey) {
129142
var idx = e.composedPath().indexOf(document.body);
130143
path= path
131144
} else {
145+
debugger
132146
// by default: don't go into the shadows
133147
path = path.filter(ea => rootNode === this.findRootNode(ea))
134148
}

src/client/poid.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,42 @@ export class Lively4URLScheme extends Scheme {
844844
}
845845
}
846846

847+
export class GSScheme_Stub extends Scheme {
848+
849+
get scheme() {
850+
return "gs";
851+
}
852+
853+
resolve() {
854+
return true
855+
}
856+
857+
static async delegatee() {
858+
if (this._delegatee) {
859+
return this._delegatee;
860+
} else {
861+
return this._delegateePromise = this._delegateePromise || new Promise(resolve => this._delegateeResolve = resolve);
862+
}
863+
}
864+
865+
static delegateTo(Scheme) {
866+
this._delegatee = Scheme;
867+
this._delegateeResolve && this._delegateeResolve(this._delegatee);
868+
}
869+
870+
async holdOff(methodName, ...args) {
871+
const NewScheme = await GSScheme_Stub.delegatee();
872+
this.migrateTo(NewScheme);
873+
return this[methodName](...args);
874+
}
875+
876+
async GET(...args) { return this.holdOff('GET', ...args); }
877+
async PUT(...args) { return this.holdOff('PUT', ...args); }
878+
async OPTIONS(...args) { return this.holdOff('OPTIONS', ...args); }
879+
async POST(...args) { return this.holdOff('POST', ...args); }
880+
async DELETE(...args) { return this.holdOff('DELETE', ...args); }
881+
}
882+
847883

848884
export default class PolymorphicIdentifier {
849885

@@ -868,6 +904,7 @@ export default class PolymorphicIdentifier {
868904
DateScheme,
869905
BooleanScheme,
870906
Lively4URLScheme,
907+
GSScheme_Stub,
871908
].forEach(scheme => this.register(scheme));
872909
}
873910

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
const SHARED_FLAG_GENERATED_IMPORT_IDENTIFIER = 'SHARED_FLAG_GENERATED_IMPORT_IDENTIFIER';
3+
4+
export default function ({ types: t, template }) {
5+
return {
6+
name: 'constraint-connectors-active-expression',
7+
visitor: {
8+
Program: {
9+
enter(path, state) {
10+
11+
}
12+
}
13+
}
14+
};
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
const SHARED_FLAG_GENERATED_IMPORT_IDENTIFIER = 'SHARED_FLAG_GENERATED_IMPORT_IDENTIFIER';
3+
4+
export default function ({ types: t, template }) {
5+
return {
6+
name: 'constraint-connectors',
7+
visitor: {
8+
Program: {
9+
enter(path, state) {
10+
11+
}
12+
}
13+
}
14+
};
15+
}

src/client/reactive/polymorphic-identifiers/polymorphic-identifiers.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,22 @@
22
export class PIScheme {
33
static get isPIScheme() { return true; }
44

5-
applyOptions(options = {}) {
6-
Object.assign(this, options);
5+
static createRef(options, strings, ...expressions) {
6+
const reference = new this();
7+
reference.configure(options, strings, ...expressions);
8+
reference.initialize();
9+
return reference;
710
}
8-
9-
create(strings, ...expressions) {
11+
12+
configure(options = {}, strings, ...expressions) {
13+
Object.assign(this, options);
1014
this.strings = strings;
1115
this.expressions = expressions;
1216
}
1317

18+
// hook into a created reference
19+
initialize() {}
20+
1421
get access() {
1522
return this.read();
1623
}
@@ -19,18 +26,12 @@ export class PIScheme {
1926
}
2027
}
2128

22-
export function makeRef(referenceClass, options) {
23-
if (referenceClass && referenceClass.isPIScheme) {
24-
const reference = new referenceClass(options);
25-
reference.applyOptions(options);
26-
27-
return (strings, ...expressions) => {
28-
reference.create(strings, ...expressions);
29-
return reference
30-
};
29+
export function makeRef(Scheme, options) {
30+
if (Scheme && Scheme.isPIScheme) {
31+
return (strings, ...expressions) => Scheme.createRef(options, strings, ...expressions);
3132
}
3233

3334
return (...args) => ({
34-
access: referenceClass(...args)
35+
access: Scheme(...args)
3536
});
3637
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'cc-ae'
2+
'pi'
3+
"enable aexpr";
4+
import chai, {expect} from 'src/external/chai.js';
5+
import sinon from 'src/external/sinon-3.2.1.js';
6+
import sinonChai from 'src/external/sinon-chai.js';
7+
chai.use(sinonChai);
8+
9+
import { PIScheme } from 'polymorphic-identifiers';
10+
import { uuid } from 'utils';
11+
12+
describe("PI", function() {
13+
14+
it("detects accesses", () => {
15+
class fourtyTwo extends PIScheme {
16+
read() {
17+
return 42;
18+
}
19+
}
20+
21+
expect(fourtyTwo``).to.equal(42)
22+
23+
});
24+
25+
});

0 commit comments

Comments
 (0)