cavalion-blocks
Advanced tools
Comparing version 0.9.31 to 0.9.32
8
.md
@@ -18,4 +18,10 @@ * [CHANGELOG.md]() - [README.md]() | ||
* **[prototypes/](src/:)** | ||
* [Container](src/prototypes/:.js) [.glassy](src/prototypes/Container:.js) [.dragable](src/prototypes/Container:.js) [.sizeable](src/prototypes/Container:.js) | ||
* [Container](src/prototypes/:.js) [.glassy](src/prototypes/Container:.js) - [.zoomy](src/prototypes/Container:.js) | ||
* [.dragable](src/prototypes/Container:.js) - [.sizeable](src/prototypes/Container:.js) | ||
* [Hover](src/prototypes/Hover.js) - _basically an alias for a superclassed Container_ | ||
# `0524` | ||
* Glassy is different [Map]([!veldapps/:]) | ||
# `2022/04/17` Container.zoomy needs to emerge | ||
@@ -22,0 +28,0 @@ |
@@ -0,1 +1,5 @@ | ||
### 2022/04/17 - 0.9.32 | ||
* Fixes 404s for implicitly defined sources ([Factory](src/:.js)) | ||
### 2022/04/17 - 0.9.31 | ||
@@ -2,0 +6,0 @@ |
{ | ||
"name": "cavalion-blocks", | ||
"version": "0.9.31", | ||
"version": "0.9.32", | ||
"description": "`blocks-dot-js` `[].js`", | ||
@@ -5,0 +5,0 @@ "main": "README.js", |
116
README.md
@@ -7,22 +7,6 @@ # [ B L O C K S ] | ||
*user specific, scaffolding, templates, ...* | ||
This project is born out of the need of: | ||
* to persist the structure (routes, models, translations, ...) of the app as meta data for the app itself | ||
* to reboot/refresh a context, without worrying about details in (or _at the level of_) cavalion-vcl, well, at least hide or abstract them away in a new API | ||
* focus soley on the native-JS like way of doing this | ||
* Object.create, real properties -and all- | ||
* await, promise, etc. | ||
>> ![](https://i.snag.gy/Bb0fhd.jpg?2x) | ||
![](https://i.snag.gy/Bb0fhd.jpg) | ||
* nicer/simpler/cleaner (Markdown-like?) syntax | ||
* rewrite of Code | ||
* rename to ide? | ||
* better Navigator | ||
* better event handling | ||
* see what this blocks thing can do | ||
--- | ||
--- | ||
# Syntax | ||
@@ -35,3 +19,3 @@ | ||
![](https://i.snag.gy/mdpjMv.jpg) | ||
>> ![](https://i.snag.gy/mdpjMv.jpg) | ||
@@ -43,94 +27,2 @@ Where it is assumed that `inherits` (when it's a string value) is a reference to, either; | ||
![](https://i.snag.gy/1Iec27.jpg) | ||
# Array.prototype ( === Blocks?) | ||
You can do all kinds of (silly?) things through Array.prototype: | ||
[["Page"], ... ].instantiate(); | ||
[].require() | ||
[].define({}) | ||
["1", "2", window].hash(type) | ||
Owner is the root of a scope. | ||
### Scope | ||
- app/super-root | ||
- root/owner | ||
- ...others owned by root | ||
- | ||
## PouchDB | ||
**Thinker**: Wat gebeurt er als de md5-hash van het JSON van het object de key van het object wat ge-put wordt is? | ||
Dan kan je in principe 1 store hebben voor al je objecten. | ||
["bedrijf", "projectcode", "versie"].hash(instance, "md5"); | ||
## Remove Dead Wood | ||
cavalion-vcl is too bloated. Too much stuff of Borland's VCL is in there that doesn't make any sense. But, it works now and I don't want to spend too much time on it to improve it (just yet). So expose a clean interface [BLOCKS], which basically hides all VCL, or at least: | ||
* specific implementations | ||
* property definitions | ||
* | ||
## Addressing | ||
/ide/workspaces/code/sidebar: | ||
-> ide/Workspace<code> #sidebar | ||
-> ide/Workspace<> #sidebar | ||
## Generating | ||
Generation is constant. Every block is a PouchDB document. Every save is a revision. | ||
# If one could define property like accessors in Blocks | ||
## Analogies | ||
* **Workspace** - **Project**s consist of **Folder**s, consisting **File**s, as such defining a set of **Path**s mapped to **Source**. **Type**s are assumed by code. | ||
* **Application** - **Root**s consist of **Block**s, consisting of **Component**s, as such defining... | ||
* **Bedrijf** (Workspace<Veldoffice>) | ||
- [**Onderzoek**, **Locatie**] -> [**Waarneming**] | ||
- [**Onderzoek**, **Code**] -> [**Document**] | ||
- | ||
Velapps, Veldoffice, Veldapp, Workspace<Veldoffice> | ||
Velddata | ||
* app: | ||
* local/field: latitude, longitude, altitude, photos, | ||
* user: | ||
block := [inherits, name, properties, children] | ||
inherits := inherits | [base, mixin, mixin] | ||
- name | ||
- properties | ||
- children | ||
- parent | ||
- owner/tree | ||
- | ||
BLOCKS loaded should pass-on inherited loaded | ||
---- | ||
>> ![](https://i.snag.gy/1Iec27.jpg) |
@@ -558,5 +558,5 @@ define(function(require) { | ||
console.log("blocks/Factory!! " + name); | ||
return onLoad(name); | ||
return load(name); | ||
} | ||
if(name.indexOf("vcl-comps:") === 0) { | ||
@@ -585,4 +585,2 @@ // #1453 (duck-typing VclFactory vs BlocksFactory) | ||
if(Factory.implicit_sources[name]) { console.warn("debugme") }; | ||
Factory.implicit_sources[name] = { | ||
@@ -597,2 +595,6 @@ source: source, | ||
if(Factory.implicit_sources[name]) { | ||
return instantiate(Factory.implicit_sources[name].source); | ||
} | ||
// TODO maybe reject() should not be the fallback but rather resolve(null) | ||
@@ -599,0 +601,0 @@ this.fetch(name).then(instantiate).catch(fallback); |
@@ -1,38 +0,14 @@ | ||
var WIDTH = 985, HEIGHT = 600, ZOOM_C = 2; | ||
var WIDTH = 985, HEIGHT = 600, ZOOM_C = 1; | ||
function e(e, o, t, i) { | ||
for (; o >= t && !e("(min-resolution: " + o / i + "dppx)").matches;) o--; | ||
return o; | ||
} | ||
function o(o) { | ||
if (void 0 === o && (o = window), !o) return 1; | ||
if (void 0 !== o.devicePixelRatio) return o.devicePixelRatio; | ||
var t = o.document.frames; | ||
return void 0 !== t ? void 0 !== t.devicePixelRatio ? t.devicePixelRatio : t.screen.deviceXDPI / t.screen.systemXDPI : void 0 !== o.matchMedia ? | ||
function (o) { | ||
for (var t = o.matchMedia, i = 10, r = .1, n = 1, c = i, d = 0; d < 4; d++) i = (c = 10 * e(t, i, r, n)) + 9, | ||
r = c, | ||
n *= 10; | ||
return c / n | ||
} (o) : 1 | ||
} | ||
function zoomLevel() { | ||
return o.apply(this, arguments); | ||
} | ||
// Maybe introduce a .zoomy class? | ||
// function elementZoomLevel(e, t) { | ||
// var i = (e instanceof Element ? getComputedStyle(e).zoom : e.zoom) || ZOOM_C; | ||
// return o(t) * ("string" == typeof i ? parseFloat(i) : i); | ||
// } | ||
[(""), { | ||
autoSize: "both", autoPosition: "all", align: "none", | ||
classes: "right -shrink-to-corner", | ||
classes: "right shrink-to-corner with-shadow", | ||
css: { | ||
'': { | ||
'flex-shrink': "0", | ||
'box-shadow': "0 0 20px 10px rgba(0,0,0,.2)", | ||
// 'box-shadow': "0 0 20px 10px rgba(0,0,0,.2)", | ||
'height': HEIGHT + "px", | ||
'width': WIDTH + "px", | ||
// 'margin-left': "auto", | ||
// 'margin-right': "auto", | ||
'top': "5%", | ||
@@ -85,12 +61,12 @@ 'border-radius': "25px", | ||
this.override({ | ||
renderZoom: function() { | ||
/** @overriding vcl/ui/Panel - transform-origin will be set by css */ | ||
var zoomed = this.hasOwnProperty("_zoom"); | ||
var style = this._node.style; | ||
if(zoomed) { | ||
style.transform = String.format("scale3d(%s, %s, 1)", this._zoom, this._zoom); | ||
} else { | ||
style.transform = ""; | ||
} | ||
}, | ||
// renderZoom: function() { | ||
// /** @overriding vcl/ui/Panel - transform-origin will be set by css */ | ||
// var zoomed = this.hasOwnProperty("_zoom"); | ||
// var style = this._node.style; | ||
// if(zoomed) { | ||
// style.transform = String.format("scale3d(%s, %s, 1)", this._zoom, this._zoom); | ||
// } else { | ||
// style.transform = ""; | ||
// } | ||
// }, | ||
initializeNodes: function() { | ||
@@ -110,87 +86,7 @@ this.inherited(arguments); | ||
}, | ||
onDestroy() { | ||
this.app().qs("#window").un(this.vars("listener")); | ||
}, | ||
onNodeCreated() { | ||
var zoomC = this.vars("zoomC") || ZOOM_C; // TODO find better name | ||
var moveLater = () => this.setTimeout("move", () => { | ||
// # CVLN-20220401-1-Panel-zoom-property | ||
this._node.style.bottom = ""; | ||
this._node.style.right = ""; | ||
}, 1000); | ||
var win = this.app().qs("#window"); | ||
var zoom0 = zoomLevel() / zoomC, width0 = win._node.clientWidth; | ||
this.set("parent", win); | ||
this.print(js.sf("zoom0: %s, width0: %s", zoom0, width0)); | ||
this.set("zoom", 1 / zoom0); | ||
this.vars("listener", win.on("resize", () => { | ||
var zoom = zoomLevel() / zoomC, width = win._node.clientWidth; | ||
this.print(js.sf("width0: %s, width: %s %s", width0, width, zoom0 === zoom ? "!!!" : "")); | ||
if(width0 !== width) { | ||
this.set("zoom", (1 / zoom)); | ||
} else { | ||
this.set("zoom", 1 / zoom0); | ||
} | ||
moveLater(); | ||
})); | ||
moveLater(); | ||
this.set("parent", this.up("devtools/Workspace<>:root") || this.app().qs("#window")); | ||
return this.inherited(arguments); | ||
}, | ||
} | ||
handlers: { | ||
'vcl/ui/List#list onScroll'(e) { | ||
var hasClass = this._header.hasClass("scrolled"); | ||
var scrollTop = this._nodes.body.scrollTop; | ||
if(scrollTop > 40) { | ||
!hasClass && this._header.addClass("scrolled"); | ||
} else { | ||
hasClass && this._header.removeClass("scrolled"); | ||
} | ||
var list = this.ud("#labels"); | ||
var scrollLeft = this._nodes.body.scrollLeft; | ||
hasClass = list.hasClass("scrolled"); | ||
if(scrollLeft > 75) { | ||
!hasClass && list.addClass("scrolled"); | ||
} else { | ||
hasClass && list.removeClass("scrolled"); | ||
} | ||
// this.ud("#labels")._nodes.body.scrollTop = scrollTop; | ||
} | ||
}, | ||
this_onDispatchChildEvent() { | ||
}, | ||
list_onScroll() { | ||
var hasClass = this._header.hasClass("scrolled"); | ||
var scrollTop = this._nodes.body.scrollTop; | ||
if(scrollTop > 40) { | ||
!hasClass && this._header.addClass("scrolled"); | ||
} else { | ||
hasClass && this._header.removeClass("scrolled"); | ||
} | ||
var list = this.ud("#labels"); | ||
var scrollLeft = this._nodes.body.scrollLeft; | ||
hasClass = list.hasClass("scrolled"); | ||
if(scrollLeft > 75) { | ||
!hasClass && list.addClass("scrolled"); | ||
} else { | ||
hasClass && list.removeClass("scrolled"); | ||
} | ||
this.ud("#labels")._nodes.body.scrollTop = scrollTop; | ||
} | ||
}]; |
92564
53
2321