@thi.ng/layout 1.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -4
- package/README.md +14 -5
- package/box.d.ts +1 -1
- package/checks.d.ts +3 -0
- package/checks.js +2 -0
- package/grid-layout.d.ts +1 -1
- package/grid-layout.js +1 -1
- package/index.d.ts +4 -4
- package/index.js +4 -4
- package/package.json +39 -22
- package/is-layout.d.ts +0 -3
- package/is-layout.js +0 -2
- package/lib/index.js +0 -89
- package/lib/index.js.map +0 -1
- package/lib/index.umd.js +0 -1
- package/lib/index.umd.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [
|
|
6
|
+
## [2.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/layout@2.0.2...@thi.ng/layout@2.0.3) (2021-10-15)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @thi.ng/layout
|
|
9
9
|
|
|
@@ -11,9 +11,57 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
## [2.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/layout@2.0.1...@thi.ng/layout@2.0.2) (2021-10-15)
|
|
15
15
|
|
|
16
|
+
**Note:** Version bump only for package @thi.ng/layout
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [2.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/layout@2.0.0...@thi.ng/layout@2.0.1) (2021-10-13)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @thi.ng/layout
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/layout@1.0.2...@thi.ng/layout@2.0.0) (2021-10-12)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Build System
|
|
34
|
+
|
|
35
|
+
* major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### BREAKING CHANGES
|
|
39
|
+
|
|
40
|
+
* discontinue CommonJS & UMD versions
|
|
41
|
+
|
|
42
|
+
- only ESM modules will be published from now on
|
|
43
|
+
- CJS obsolete due to ESM support in recent versions of node:
|
|
44
|
+
- i.e. launch NodeJS via:
|
|
45
|
+
- `node --experimental-specifier-resolution=node --experimental-repl-await`
|
|
46
|
+
- in the node REPL use `await import(...)` instead of `require()`
|
|
47
|
+
- UMD obsolete due to widespread browser support for ESM
|
|
48
|
+
|
|
49
|
+
Also:
|
|
50
|
+
- normalize/restructure/reorg all package.json files
|
|
51
|
+
- cleanup all build scripts, remove obsolete
|
|
52
|
+
- switch from mocha to @thi.ng/testament for all tests
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## [1.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/layout@1.0.1...@thi.ng/layout@1.0.2) (2021-09-03)
|
|
60
|
+
|
|
61
|
+
**Note:** Version bump only for package @thi.ng/layout
|
|
62
|
+
|
|
63
|
+
# 0.1.0 (2020-02-25)
|
|
16
64
|
|
|
17
|
-
###
|
|
65
|
+
### Features
|
|
18
66
|
|
|
19
|
-
|
|
67
|
+
- **layout:** import as new pkg (extracted from [@thi](https://github.com/thi).ng/imgui) ([e5efc16](https://github.com/thi-ng/umbrella/commit/e5efc165253480aff8068e4cde31bba4aec018d1))
|
package/README.md
CHANGED
|
@@ -40,15 +40,24 @@ to define other layout types / implementations.
|
|
|
40
40
|
yarn add @thi.ng/layout
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
ES module import:
|
|
44
|
+
|
|
43
45
|
```html
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
<script type="module" src="https://cdn.skypack.dev/@thi.ng/layout"></script>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
[Skypack documentation](https://docs.skypack.dev/)
|
|
50
|
+
|
|
51
|
+
For Node.js REPL:
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
# with flag only for < v16
|
|
55
|
+
node --experimental-repl-await
|
|
46
56
|
|
|
47
|
-
|
|
48
|
-
<script src="https://unpkg.com/@thi.ng/layout/lib/index.umd.js" crossorigin></script>
|
|
57
|
+
> const layout = await import("@thi.ng/layout");
|
|
49
58
|
```
|
|
50
59
|
|
|
51
|
-
Package sizes (gzipped, pre-treeshake): ESM:
|
|
60
|
+
Package sizes (gzipped, pre-treeshake): ESM: 677 bytes
|
|
52
61
|
|
|
53
62
|
## Dependencies
|
|
54
63
|
|
package/box.d.ts
CHANGED
package/checks.d.ts
ADDED
package/checks.js
ADDED
package/grid-layout.d.ts
CHANGED
package/grid-layout.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./api";
|
|
2
|
-
export * from "./box";
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
1
|
+
export * from "./api.js";
|
|
2
|
+
export * from "./box.js";
|
|
3
|
+
export * from "./checks.js";
|
|
4
|
+
export * from "./grid-layout.js";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./api";
|
|
2
|
-
export * from "./box";
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
1
|
+
export * from "./api.js";
|
|
2
|
+
export * from "./box.js";
|
|
3
|
+
export * from "./checks.js";
|
|
4
|
+
export * from "./grid-layout.js";
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/layout",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Configurable nested 2D grid layout manager",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"module": "./index.js",
|
|
6
|
-
"main": "./lib/index.js",
|
|
7
|
-
"umd:main": "./lib/index.umd.js",
|
|
8
7
|
"typings": "./index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/thi-ng/umbrella.git"
|
|
@@ -24,27 +24,21 @@
|
|
|
24
24
|
"author": "Karsten Schmidt <k+npm@thi.ng>",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"scripts": {
|
|
27
|
-
"build": "yarn clean &&
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"build:test": "rimraf build && tsc -p test/tsconfig.json",
|
|
31
|
-
"build:check": "tsc --isolatedModules --noEmit",
|
|
32
|
-
"test": "mocha test",
|
|
33
|
-
"cover": "nyc mocha test && nyc report --reporter=lcov",
|
|
34
|
-
"clean": "rimraf *.js *.d.ts *.map .nyc_output build coverage doc lib",
|
|
35
|
-
"doc:readme": "ts-node -P ../../tools/tsconfig.json ../../tools/src/readme.ts",
|
|
27
|
+
"build": "yarn clean && tsc --declaration",
|
|
28
|
+
"clean": "rimraf *.js *.d.ts *.map doc",
|
|
29
|
+
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
36
30
|
"doc:ae": "mkdir -p .ae/doc .ae/temp && node_modules/.bin/api-extractor run --local --verbose",
|
|
37
|
-
"doc": "
|
|
38
|
-
"
|
|
31
|
+
"doc:readme": "yarn doc:stats && ../../scripts/node-esm ../../tools/src/readme.ts",
|
|
32
|
+
"doc:stats": "../../scripts/node-esm ../../tools/src/module-stats.ts",
|
|
33
|
+
"pub": "yarn build && yarn publish --access public",
|
|
34
|
+
"test": "testament test"
|
|
39
35
|
},
|
|
40
36
|
"dependencies": {
|
|
41
|
-
"@thi.ng/checks": "^
|
|
37
|
+
"@thi.ng/checks": "^3.0.3"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@thi.ng/testament": "^0.1.3"
|
|
42
41
|
},
|
|
43
|
-
"files": [
|
|
44
|
-
"*.js",
|
|
45
|
-
"*.d.ts",
|
|
46
|
-
"lib"
|
|
47
|
-
],
|
|
48
42
|
"keywords": [
|
|
49
43
|
"2d",
|
|
50
44
|
"align",
|
|
@@ -60,9 +54,32 @@
|
|
|
60
54
|
"publishConfig": {
|
|
61
55
|
"access": "public"
|
|
62
56
|
},
|
|
63
|
-
"
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=12.7"
|
|
59
|
+
},
|
|
60
|
+
"files": [
|
|
61
|
+
"*.js",
|
|
62
|
+
"*.d.ts"
|
|
63
|
+
],
|
|
64
|
+
"exports": {
|
|
65
|
+
".": {
|
|
66
|
+
"import": "./index.js"
|
|
67
|
+
},
|
|
68
|
+
"./api": {
|
|
69
|
+
"import": "./api.js"
|
|
70
|
+
},
|
|
71
|
+
"./box": {
|
|
72
|
+
"import": "./box.js"
|
|
73
|
+
},
|
|
74
|
+
"./checks": {
|
|
75
|
+
"import": "./checks.js"
|
|
76
|
+
},
|
|
77
|
+
"./grid-layout": {
|
|
78
|
+
"import": "./grid-layout.js"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
64
81
|
"thi.ng": {
|
|
65
82
|
"year": 2019
|
|
66
83
|
},
|
|
67
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "1fb38cac74d6c009d96855c28784a267a81badf1"
|
|
68
85
|
}
|
package/is-layout.d.ts
DELETED
package/is-layout.js
DELETED
package/lib/index.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var checks = require('@thi.ng/checks');
|
|
6
|
-
|
|
7
|
-
const layoutBox = (x, y, w, h, cw, ch, gap) => ({ x, y, w, h, cw, ch, gap });
|
|
8
|
-
|
|
9
|
-
const DEFAULT_SPANS = [1, 1];
|
|
10
|
-
class GridLayout {
|
|
11
|
-
constructor(parent, x, y, width, cols, rowH, gap) {
|
|
12
|
-
this.parent = parent;
|
|
13
|
-
this.cols = cols;
|
|
14
|
-
this.x = x;
|
|
15
|
-
this.y = y;
|
|
16
|
-
this.width = width;
|
|
17
|
-
this.cellW = (width - (cols - 1) * gap) / cols;
|
|
18
|
-
this.cellH = rowH;
|
|
19
|
-
this.cellWG = this.cellW + gap;
|
|
20
|
-
this.cellHG = rowH + gap;
|
|
21
|
-
this.gap = gap;
|
|
22
|
-
this.currCol = 0;
|
|
23
|
-
this.currRow = 0;
|
|
24
|
-
this.rows = 0;
|
|
25
|
-
}
|
|
26
|
-
colsForWidth(w) {
|
|
27
|
-
return Math.ceil(w / this.cellWG);
|
|
28
|
-
}
|
|
29
|
-
rowsForHeight(h) {
|
|
30
|
-
return Math.ceil(h / this.cellHG);
|
|
31
|
-
}
|
|
32
|
-
spansForSize(w, h) {
|
|
33
|
-
const size = checks.isNumber(w) ? [w, h] : w;
|
|
34
|
-
return [this.colsForWidth(size[0]), this.rowsForHeight(size[1])];
|
|
35
|
-
}
|
|
36
|
-
next(spans = DEFAULT_SPANS) {
|
|
37
|
-
const { cellWG, cellHG, gap, cols } = this;
|
|
38
|
-
const cspan = Math.min(spans[0], cols);
|
|
39
|
-
const rspan = spans[1];
|
|
40
|
-
if (this.currCol > 0) {
|
|
41
|
-
if (this.currCol + cspan > cols) {
|
|
42
|
-
this.currCol = 0;
|
|
43
|
-
this.currRow = this.rows;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
this.currRow = this.rows;
|
|
48
|
-
}
|
|
49
|
-
const h = rspan * cellHG - gap;
|
|
50
|
-
const cell = {
|
|
51
|
-
x: this.x + this.currCol * cellWG,
|
|
52
|
-
y: this.y + this.currRow * cellHG,
|
|
53
|
-
w: cspan * cellWG - gap,
|
|
54
|
-
h,
|
|
55
|
-
cw: this.cellW,
|
|
56
|
-
ch: this.cellH,
|
|
57
|
-
gap,
|
|
58
|
-
};
|
|
59
|
-
this.propagateSize(rspan);
|
|
60
|
-
this.currCol = Math.min(this.currCol + cspan, cols) % cols;
|
|
61
|
-
return cell;
|
|
62
|
-
}
|
|
63
|
-
nextSquare() {
|
|
64
|
-
const box = this.next([
|
|
65
|
-
1,
|
|
66
|
-
Math.ceil(this.cellW / (this.cellH + this.gap)) + 1,
|
|
67
|
-
]);
|
|
68
|
-
box.h = box.w;
|
|
69
|
-
return box;
|
|
70
|
-
}
|
|
71
|
-
nest(cols, spans) {
|
|
72
|
-
const { x, y, w } = this.next(spans);
|
|
73
|
-
return new GridLayout(this, x, y, w, cols, this.cellH, this.gap);
|
|
74
|
-
}
|
|
75
|
-
propagateSize(rspan) {
|
|
76
|
-
let rows = this.rows;
|
|
77
|
-
this.rows = rows = Math.max(rows, this.currRow + rspan);
|
|
78
|
-
const parent = this.parent;
|
|
79
|
-
parent && parent.propagateSize(rows);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
const gridLayout = (x, y, width, cols = 1, rowH = 16, gap = 4) => new GridLayout(null, x, y, width, cols, rowH, gap);
|
|
83
|
-
|
|
84
|
-
const isLayout = (x) => checks.implementsFunction(x, "next");
|
|
85
|
-
|
|
86
|
-
exports.GridLayout = GridLayout;
|
|
87
|
-
exports.gridLayout = gridLayout;
|
|
88
|
-
exports.isLayout = isLayout;
|
|
89
|
-
exports.layoutBox = layoutBox;
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../box.js","../grid-layout.js","../is-layout.js"],"sourcesContent":null,"names":["isNumber","implementsFunction"],"mappings":";;;;;;AAAY,M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C,GAAG,CAAC,CAAC;AACzE,KAAK;AAML,IAAI,aAAa,CAAC,KAAK,EAAE;AACzB,QAAQ,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;AAC7B,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;AAChE,QAAQ,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;AACnC,QAAQ,MAAM,IAAI,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AAC7C,KAAK;AACL,CAAC;AAYW,MAAC,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,GAAG,CAAC,KAAK,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG;;ACzF9G,MAAC,QAAQ,GAAG,CAAC,CAAC,KAAKC,yBAAkB,CAAC,CAAC,EAAE,MAAM;;;;;;;"}
|
package/lib/index.umd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("@thi.ng/checks")):"function"==typeof define&&define.amd?define(["exports","@thi.ng/checks"],i):i(((t="undefined"!=typeof globalThis?globalThis:t||self).thi=t.thi||{},t.thi.ng=t.thi.ng||{},t.thi.ng.layout={}),t.thi.ng.checks)}(this,(function(t,i){"use strict";const s=[1,1];class e{constructor(t,i,s,e,h,r,o){this.parent=t,this.cols=h,this.x=i,this.y=s,this.width=e,this.cellW=(e-(h-1)*o)/h,this.cellH=r,this.cellWG=this.cellW+o,this.cellHG=r+o,this.gap=o,this.currCol=0,this.currRow=0,this.rows=0}colsForWidth(t){return Math.ceil(t/this.cellWG)}rowsForHeight(t){return Math.ceil(t/this.cellHG)}spansForSize(t,s){const e=i.isNumber(t)?[t,s]:t;return[this.colsForWidth(e[0]),this.rowsForHeight(e[1])]}next(t=s){const{cellWG:i,cellHG:e,gap:h,cols:r}=this,o=Math.min(t[0],r),c=t[1];this.currCol>0?this.currCol+o>r&&(this.currCol=0,this.currRow=this.rows):this.currRow=this.rows;const l=c*e-h,n={x:this.x+this.currCol*i,y:this.y+this.currRow*e,w:o*i-h,h:l,cw:this.cellW,ch:this.cellH,gap:h};return this.propagateSize(c),this.currCol=Math.min(this.currCol+o,r)%r,n}nextSquare(){const t=this.next([1,Math.ceil(this.cellW/(this.cellH+this.gap))+1]);return t.h=t.w,t}nest(t,i){const{x:s,y:h,w:r}=this.next(i);return new e(this,s,h,r,t,this.cellH,this.gap)}propagateSize(t){let i=this.rows;this.rows=i=Math.max(i,this.currRow+t);const s=this.parent;s&&s.propagateSize(i)}}t.GridLayout=e,t.gridLayout=(t,i,s,h=1,r=16,o=4)=>new e(null,t,i,s,h,r,o),t.isLayout=t=>i.implementsFunction(t,"next"),t.layoutBox=(t,i,s,e,h,r,o)=>({x:t,y:i,w:s,h:e,cw:h,ch:r,gap:o}),Object.defineProperty(t,"__esModule",{value:!0})}));
|
package/lib/index.umd.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../box.js","../grid-layout.js","../is-layout.js"],"sourcesContent":null,"names":["isNumber","implementsFunction"],"mappings":";;;;;;AAAY,UAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE;;ICClF,MAAM,aAAa,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtB,MAAM,UAAU,CAAC;IACxB,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC,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