tauri-kargo-tools 0.1.6 → 0.1.8
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/package.json +1 -1
- package/src/builder/space.ts +13 -0
- package/src/model/space.ts +5 -0
- package/src/test/test-model.ts +1 -1
- package/src/test/test-polymorphe.ts +5 -1
- package/src/test/test-vue-boot.ts +3 -1
- package/src/test/test-vue-panel.ts +1 -1
- package/src/vue-builder.ts +18 -2
- package/src/vue-model.ts +11 -3
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Space } from "../model/space";
|
|
2
|
+
import { applySize, Builder, Ctx } from "../vue-builder";
|
|
3
|
+
|
|
4
|
+
/* ----------- Flow ----------- */
|
|
5
|
+
export function buildSpace<T extends object>(builder:Builder,node: Space, ctx: Ctx<T>) {
|
|
6
|
+
const div = document.createElement('div');
|
|
7
|
+
|
|
8
|
+
div.style.visibility ="hidden"
|
|
9
|
+
applySize(div, node.width, node.height);
|
|
10
|
+
ctx.add(div);
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
|
package/src/test/test-model.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ElementPanel } from "./test-model-panel"
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export class Base extends ElementPanel {
|
|
8
8
|
op!: string
|
|
9
9
|
a!: number
|
|
10
10
|
b!: number
|
|
@@ -105,6 +105,10 @@ defineVue(MenuOp, {
|
|
|
105
105
|
action: "mul",
|
|
106
106
|
width: "100%"
|
|
107
107
|
},
|
|
108
|
+
{
|
|
109
|
+
kind: 'space',
|
|
110
|
+
height: 10
|
|
111
|
+
},
|
|
108
112
|
{
|
|
109
113
|
kind: 'staticButton',
|
|
110
114
|
label: '/',
|
package/src/vue-builder.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { buildLabel, buildStaticLabel } from "./builder/label";
|
|
|
15
15
|
import { buildListOfVue } from "./builder/list-of-vue";
|
|
16
16
|
import { buildMenu } from "./builder/menu";
|
|
17
17
|
import { buildSelect } from "./builder/select";
|
|
18
|
+
import { buildSpace } from "./builder/space";
|
|
18
19
|
import { buildSingleVue } from "./builder/vue";
|
|
19
20
|
import { Listener, Unlisten } from "./listener";
|
|
20
21
|
import { getListener } from "./listener-factory";
|
|
@@ -29,6 +30,7 @@ import { LabelNode, StaticLabelNode } from "./model/label";
|
|
|
29
30
|
import { ListVueNode } from "./model/list-of-vue";
|
|
30
31
|
import { MenuNode } from "./model/menu";
|
|
31
32
|
import { SelectNode } from "./model/select";
|
|
33
|
+
import { Space } from "./model/space";
|
|
32
34
|
import { SingleVueNode } from "./model/vue";
|
|
33
35
|
import {
|
|
34
36
|
Vue, UINode
|
|
@@ -124,8 +126,21 @@ export class Builder {
|
|
|
124
126
|
}
|
|
125
127
|
|
|
126
128
|
/** Monte `ui` dans `selector`. */
|
|
127
|
-
boot<T extends object>(a: T, selector
|
|
128
|
-
|
|
129
|
+
boot<T extends object>(a: T, selector?: string): VueRuntime<T> {
|
|
130
|
+
if (!selector) {
|
|
131
|
+
document.body.className = "app"
|
|
132
|
+
this.container = document.createElement("div")
|
|
133
|
+
document.body.appendChild(this.container)
|
|
134
|
+
const link = document.createElement("link")
|
|
135
|
+
link.rel ="stylesheet"
|
|
136
|
+
const scriptUrl = import.meta.url;
|
|
137
|
+
const scriptDir = scriptUrl.substring(0, scriptUrl.lastIndexOf('/') + 1);
|
|
138
|
+
const cssLink= `${scriptDir}css/vue-darkmode.css`
|
|
139
|
+
link.href = cssLink
|
|
140
|
+
document.body.appendChild(link)
|
|
141
|
+
} else {
|
|
142
|
+
this.container = document.querySelector(selector) as HTMLElement | null;
|
|
143
|
+
}
|
|
129
144
|
if (!this.container) throw new Error('Conteneur introuvable : ' + selector);
|
|
130
145
|
this.container.replaceChildren()
|
|
131
146
|
return this.bootInto(this.findVueFor(a)!, a, this.container);
|
|
@@ -204,6 +219,7 @@ export class Builder {
|
|
|
204
219
|
case 'custom': buildCustom(this, node as CustomNode<T, any, any>, ctx); break;
|
|
205
220
|
case "bootVue": buildBootVue(this, node as BootVueNode<T, any>, ctx); break;
|
|
206
221
|
case 'staticBootVue': buildStaticBootVue(this, node as StaticBootVueNode<T>, ctx); break;
|
|
222
|
+
case "space": buildSpace(this, node as Space, ctx);
|
|
207
223
|
}
|
|
208
224
|
}
|
|
209
225
|
}
|
package/src/vue-model.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { LabelNode, StaticLabelNode } from "./model/label";
|
|
|
14
14
|
import { ListVueNode } from "./model/list-of-vue";
|
|
15
15
|
import { MenuNode } from "./model/menu";
|
|
16
16
|
import { SelectNode } from "./model/select";
|
|
17
|
+
import { Space } from "./model/space";
|
|
17
18
|
import { SingleVueNode } from "./model/vue";
|
|
18
19
|
|
|
19
20
|
/* ===================== Types utils et exports ===================== */
|
|
@@ -83,6 +84,7 @@ export type UINode<T extends object> =
|
|
|
83
84
|
| CustomNode<T>
|
|
84
85
|
| StaticLabelNode<T>
|
|
85
86
|
| BootVueNode<T>
|
|
87
|
+
| Space
|
|
86
88
|
| StaticBootVueNode<T>;
|
|
87
89
|
|
|
88
90
|
/* ===================== UI (déclaratif uniquement) ===================== */
|
|
@@ -167,6 +169,12 @@ export class Vue<T extends object> {
|
|
|
167
169
|
this.cursor.push(node as unknown as UINode<T>);
|
|
168
170
|
return this;
|
|
169
171
|
}
|
|
172
|
+
space(width: string, height: string) {
|
|
173
|
+
const space: Space = { kind: "space", width: width, height: height }
|
|
174
|
+
this.cursor.push(space);
|
|
175
|
+
return this;
|
|
176
|
+
|
|
177
|
+
}
|
|
170
178
|
|
|
171
179
|
/* ------------ Img ------------ */
|
|
172
180
|
img<NK extends KeysOfType<T, string>>(opts: {
|
|
@@ -366,7 +374,7 @@ export class Vue<T extends object> {
|
|
|
366
374
|
width?: number | string; height?: number | string;
|
|
367
375
|
closeOnBackdrop?: boolean; closeOnEsc?: boolean; modal?: boolean;
|
|
368
376
|
visible?: KeysOfType<T, boolean>; enable?: KeysOfType<T, boolean>;
|
|
369
|
-
|
|
377
|
+
useVisibility?: boolean;
|
|
370
378
|
action?: KeysOfType<T, () => void>;
|
|
371
379
|
/** Nouveau : rendu du bouton trigger */
|
|
372
380
|
type?: ButtonContentType;
|
|
@@ -390,7 +398,7 @@ export class Vue<T extends object> {
|
|
|
390
398
|
width?: number | string; height?: number | string;
|
|
391
399
|
closeOnBackdrop?: boolean; closeOnEsc?: boolean; modal?: boolean;
|
|
392
400
|
visible?: KeysOfType<T, boolean>; enable?: KeysOfType<T, boolean>;
|
|
393
|
-
|
|
401
|
+
useVisibility?: boolean;
|
|
394
402
|
action?: KeysOfType<T, () => void>;
|
|
395
403
|
/** Nouveau : rendu du bouton trigger */
|
|
396
404
|
type?: ButtonContentType;
|
|
@@ -409,7 +417,7 @@ export class Vue<T extends object> {
|
|
|
409
417
|
id?: string; class?: string | string[];
|
|
410
418
|
width?: number | string; height?: number | string;
|
|
411
419
|
visible?: KeysOfType<T, boolean>; enable?: KeysOfType<T, boolean>;
|
|
412
|
-
|
|
420
|
+
useVisibility?: boolean;
|
|
413
421
|
/** Nom de la méthode de T: () => HTMLElement */
|
|
414
422
|
factory: FK;
|
|
415
423
|
/** Nom de la méthode d'init: () => void (optionnelle) */
|