ziko 0.38.0 → 0.39.0
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/dist/ziko.cjs +165 -759
- package/dist/ziko.js +165 -759
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +164 -756
- package/package.json +2 -1
- package/src/__helpers__/composition-dep/compose-class.js +46 -0
- package/src/__helpers__/register/index.js +6 -0
- package/src/__helpers__/register/register-to-class.js +16 -0
- package/src/__helpers__/register/register-to-instance.js +18 -0
- package/src/__ziko__/index.js +12 -11
- package/src/events/types/clipboard.d.ts +2 -2
- package/src/events/types/focus.d.ts +2 -2
- package/src/events/types/pointer.d.ts +2 -2
- package/src/hooks/use-state.js +5 -0
- package/src/reactivity/hooks/UI/index.js +1 -1
- package/src/ui/__methods__/attrs.js +46 -0
- package/src/ui/__methods__/index.js +5 -0
- package/src/ui/__methods__/style.js +14 -0
- package/src/ui/__utils__/index.js +2 -2
- package/src/ui/constructors/{ZikoUIElement.js → UIElement.js} +30 -82
- package/src/ui/constructors/{ZikoUINode.js → UINode.js} +2 -2
- package/src/ui/flex/index.js +8 -8
- package/src/ui/graphics/canvas.js +2 -2
- package/src/ui/graphics/svg.js +2 -2
- package/src/ui/grid/index.js +4 -4
- package/src/ui/index.js +2 -2
- package/src/ui/suspense/index.js +3 -3
- package/src/ui/tags/index.d.ts.txt +125 -125
- package/src/ui/tags/index.js +28 -18
- package/src/ui/text/index.js +2 -2
- package/src/ui/wrapper/index.js +3 -3
- package/src/__helpers__/composition/compose-class.js +0 -28
- /package/src/__helpers__/{composition → composition-dep}/compose-instance.js +0 -0
- /package/src/__helpers__/{composition → composition-dep}/compose.js +0 -0
- /package/src/__helpers__/{composition → composition-dep}/index.js +0 -0
- /package/src/ui/constructors/{ZikoUIElementMethodesToBeMoved.js → ZikoUIElementMethodesToBeMoved-dep.js} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ziko",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"description": "A versatile JavaScript library offering a rich set of Hyperscript Based UI components, advanced mathematical utilities, interactivity ,animations, client side routing and more ...",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"front-end",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"./time": {},
|
|
61
61
|
"./components": {}
|
|
62
62
|
},
|
|
63
|
+
"sideEffects" : false,
|
|
63
64
|
"bin": {
|
|
64
65
|
"create-ziko-app": "starter/bin/index.js"
|
|
65
66
|
},
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export function composeClass(Class, mixin) {
|
|
2
|
+
const descriptors = Object.getOwnPropertyDescriptors(mixin);
|
|
3
|
+
|
|
4
|
+
class Composed extends Class {
|
|
5
|
+
constructor(...args) {
|
|
6
|
+
super(...args);
|
|
7
|
+
// ⚠️ Do NOT assign mixin functions to `this`
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Copy prototype properties (methods, getters/setters, non-functions)
|
|
12
|
+
for (const key of Reflect.ownKeys(descriptors)) {
|
|
13
|
+
const desc = descriptors[key];
|
|
14
|
+
|
|
15
|
+
if ('get' in desc || 'set' in desc || typeof desc.value !== 'function') {
|
|
16
|
+
Object.defineProperty(Composed.prototype, key, desc);
|
|
17
|
+
} else if (typeof desc.value === 'function') {
|
|
18
|
+
// Only add method if it does NOT already exist
|
|
19
|
+
if (!Composed.prototype.hasOwnProperty(key)) {
|
|
20
|
+
Object.defineProperty(Composed.prototype, key, desc);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return Composed;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// // Usage
|
|
29
|
+
// class UIBase {
|
|
30
|
+
// log() { console.log('UIBase log'); }
|
|
31
|
+
// }
|
|
32
|
+
|
|
33
|
+
// const mixin = {
|
|
34
|
+
// at() { return 0; },
|
|
35
|
+
// hello() { return 'hello'; }
|
|
36
|
+
// };
|
|
37
|
+
|
|
38
|
+
// const UIComposed = composeClass(UIBase, mixin);
|
|
39
|
+
|
|
40
|
+
// class UI2 extends UIComposed {
|
|
41
|
+
// at() { return 1; } // ✅ correctly overrides mixin
|
|
42
|
+
// }
|
|
43
|
+
|
|
44
|
+
// const ui = new UI2();
|
|
45
|
+
// console.log(ui.at()); // 1
|
|
46
|
+
// console.log(ui.hello()); // 'hello'
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { register_to_class } from "./register-to-class.js";
|
|
2
|
+
import { register_to_instance } from "./register-to-instance";
|
|
3
|
+
export const register = (target, ...mixins) => {
|
|
4
|
+
if(typeof target === 'function') register_to_class(target, ...mixins)
|
|
5
|
+
else register_to_instance(target, ...mixins)
|
|
6
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function register_to_class(target, ...mixins){
|
|
2
|
+
mixins.forEach(n => _register_to_class_(target, n))
|
|
3
|
+
}
|
|
4
|
+
function _register_to_class_(target, mixin) {
|
|
5
|
+
const descriptors = Object.getOwnPropertyDescriptors(mixin);
|
|
6
|
+
for (const key of Reflect.ownKeys(descriptors)) {
|
|
7
|
+
const desc = descriptors[key];
|
|
8
|
+
if ('get' in desc || 'set' in desc || typeof desc.value !== 'function') {
|
|
9
|
+
Object.defineProperty(Object.getPrototypeOf(target), key, desc);
|
|
10
|
+
} else if (typeof desc.value === 'function') {
|
|
11
|
+
if (!Object.getPrototypeOf(target).hasOwnProperty(key)) {
|
|
12
|
+
Object.defineProperty(Object.getPrototypeOf(target), key, desc);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function register_to_instance(target, ...mixins){
|
|
2
|
+
mixins.forEach(n => _register_to_instance_(target, n))
|
|
3
|
+
}
|
|
4
|
+
function _register_to_instance_(instance, mixin) {
|
|
5
|
+
const descriptors = Object.getOwnPropertyDescriptors(mixin);
|
|
6
|
+
|
|
7
|
+
for (const key of Reflect.ownKeys(descriptors)) {
|
|
8
|
+
const desc = descriptors[key];
|
|
9
|
+
|
|
10
|
+
if ('get' in desc || 'set' in desc) {
|
|
11
|
+
Object.defineProperty(instance, key, desc);
|
|
12
|
+
} else if (typeof desc.value === 'function') {
|
|
13
|
+
instance[key] = desc.value.bind(instance);
|
|
14
|
+
} else {
|
|
15
|
+
instance[key] = desc.value;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
package/src/__ziko__/index.js
CHANGED
|
@@ -3,14 +3,15 @@ import { __UI__ } from './__ui__.js';
|
|
|
3
3
|
import { __Config__ } from './__config__.js';
|
|
4
4
|
import { __HYDRATION__, __HYDRATION_MAP__ } from './__hydration__.js';
|
|
5
5
|
import { __CACHE__ } from './__cache__.js';
|
|
6
|
-
|
|
7
|
-
if ( !globalThis?.__Ziko__ ){
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
6
|
+
export function __init__global__(){
|
|
7
|
+
if ( !globalThis?.__Ziko__ ){
|
|
8
|
+
globalThis.__Ziko__ = {
|
|
9
|
+
__UI__,
|
|
10
|
+
__HYDRATION__,
|
|
11
|
+
__HYDRATION_MAP__,
|
|
12
|
+
__Config__,
|
|
13
|
+
__CACHE__,
|
|
14
|
+
};
|
|
15
|
+
defineParamsGetter(__Ziko__)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __ZikoEvent__ } from "../__ZikoEvent__.js";
|
|
2
2
|
import type { Callback, ClipboardEventKeys } from './__Shared__.js';
|
|
3
|
-
import {
|
|
3
|
+
import { UIElement } from "../../ui/index.js";
|
|
4
4
|
|
|
5
5
|
declare class ZikoEventClipboard extends __ZikoEvent__ {
|
|
6
6
|
constructor(target: any, customizer?: Function);
|
|
@@ -12,7 +12,7 @@ declare class ZikoEventClipboard extends __ZikoEvent__ {
|
|
|
12
12
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
declare const bindClipboardEvent: (target:
|
|
15
|
+
declare const bindClipboardEvent: (target: UIElement, customizer?: Function) => ZikoEventClipboard;
|
|
16
16
|
|
|
17
17
|
export {
|
|
18
18
|
ZikoEventClipboard,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __ZikoEvent__ } from "../__ZikoEvent__.js";
|
|
2
2
|
import type { Callback } from './__Shared__.js';
|
|
3
|
-
import {
|
|
3
|
+
import { UIElement } from "../../ui/index.js";
|
|
4
4
|
|
|
5
5
|
declare class ZikoEventFocus extends __ZikoEvent__ {
|
|
6
6
|
constructor(target: any, customizer?: Function);
|
|
@@ -11,7 +11,7 @@ declare class ZikoEventFocus extends __ZikoEvent__ {
|
|
|
11
11
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
declare const bindFocusEvent: (target:
|
|
14
|
+
declare const bindFocusEvent: (target: UIElement, customizer?: Function) => ZikoEventFocus;
|
|
15
15
|
|
|
16
16
|
export {
|
|
17
17
|
ZikoEventFocus,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __ZikoEvent__ } from "../__ZikoEvent__.js";
|
|
2
2
|
import type { EventMethodesBinder, Callback, PointerEventKeys } from './__Shared__.js';
|
|
3
|
-
import {
|
|
3
|
+
import { UIElement } from "../../ui/index.js";
|
|
4
4
|
|
|
5
5
|
type PointerEventMethodesBinder = EventMethodesBinder<PointerEventKeys, ZikoEventPointer>;
|
|
6
6
|
|
|
@@ -37,7 +37,7 @@ declare class ZikoEventPointer extends __ZikoEvent__ implements PointerEventMeth
|
|
|
37
37
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
declare const bindPointerEvent: (target:
|
|
40
|
+
declare const bindPointerEvent: (target: UIElement, customizer?: Function) => ZikoEventPointer;
|
|
41
41
|
|
|
42
42
|
export {
|
|
43
43
|
ZikoEventPointer,
|
package/src/hooks/use-state.js
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Str } from "../../data";
|
|
2
|
+
import { isStateGetter } from "../../hooks/use-state.js";
|
|
3
|
+
|
|
4
|
+
// To Do add getter, watchAttr
|
|
5
|
+
export const AttrsMethods = {
|
|
6
|
+
setAttr(name, value) {
|
|
7
|
+
if(name instanceof Object){
|
|
8
|
+
const [names,values]=[Object.keys(name),Object.values(name)];
|
|
9
|
+
for(let i=0;i<names.length;i++){
|
|
10
|
+
if(values[i] instanceof Array)value[i] = values[i].join(" ");
|
|
11
|
+
_set_attrs_.call(this, names[i], values[i])
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
else{
|
|
15
|
+
if(value instanceof Array) value = value.join(" ");
|
|
16
|
+
_set_attrs_.call(this, name, value)
|
|
17
|
+
}
|
|
18
|
+
return this;
|
|
19
|
+
},
|
|
20
|
+
removeAttr(...names) {
|
|
21
|
+
for(let i=0;i<names.length;i++)this.element?.removeAttribute(names[i]);
|
|
22
|
+
return this;
|
|
23
|
+
},
|
|
24
|
+
getAttr(name){
|
|
25
|
+
name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
|
|
26
|
+
return this.element.attributes[name].value;
|
|
27
|
+
},
|
|
28
|
+
setContentEditable(bool = true) {
|
|
29
|
+
this.setAttr("contenteditable", bool);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
function _set_attrs_(name, value){
|
|
35
|
+
if(this.element?.tagName !== "svg") name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
|
|
36
|
+
if(this?.attr[name] && this?.attr[name]===value) return;
|
|
37
|
+
if(isStateGetter(value)){
|
|
38
|
+
const getter = value()
|
|
39
|
+
getter._subscribe(
|
|
40
|
+
(newValue) => this.element?.setAttribute(name, newValue),
|
|
41
|
+
this
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
else this.element?.setAttribute(name, value)
|
|
45
|
+
Object.assign(this.cache.attributes, {[name]:value});
|
|
46
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Process width and height
|
|
2
|
+
export const StyleMethods = {
|
|
3
|
+
style(styles){
|
|
4
|
+
Object.assign(this.element.style, styles)
|
|
5
|
+
return this;
|
|
6
|
+
},
|
|
7
|
+
size(width, height){
|
|
8
|
+
return this.style({width, height})
|
|
9
|
+
},
|
|
10
|
+
animate(keyframe, {duration=1000, iterations=1, easing="ease"}={}){
|
|
11
|
+
this.element?.animate(keyframe,{duration, iterations, easing});
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import UIElement from "../constructors/UIElement.js";
|
|
2
2
|
const Id = (a) => document.getElementById(a);
|
|
3
3
|
const Class = (a) => [...document.getElementsByClassName(a)];
|
|
4
4
|
const $=(...selector)=>{
|
|
5
5
|
var ele=[]
|
|
6
6
|
for(let i=0;i<selector.length;i++){
|
|
7
7
|
if(typeof selector[i]=="string")ele.push(...document.querySelectorAll(selector[i]));
|
|
8
|
-
if(selector[i] instanceof
|
|
8
|
+
if(selector[i] instanceof UIElement)ele.push(selector[i].element)
|
|
9
9
|
}
|
|
10
10
|
return ele.length===1?ele[0]:ele;
|
|
11
11
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import UINode from "./UINode.js";
|
|
2
|
+
import { register } from "../../__helpers__/register/index.js";
|
|
3
|
+
import {
|
|
4
|
+
AttrsMethods,
|
|
5
|
+
DomMethods,
|
|
6
|
+
IndexingMethods,
|
|
7
|
+
EventsMethodes,
|
|
8
|
+
StyleMethods
|
|
9
|
+
} from "../__methods__/index.js";
|
|
10
|
+
|
|
8
11
|
import {
|
|
9
12
|
useCustomEvent,
|
|
10
13
|
useSwipeEvent,
|
|
@@ -14,34 +17,30 @@ import {
|
|
|
14
17
|
watchChildren
|
|
15
18
|
} from "../../reactivity/index.js"
|
|
16
19
|
import { Random } from "../../math/index.js";
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
class
|
|
20
|
-
constructor(element, name=
|
|
20
|
+
import {__init__global__} from '../../__ziko__/index.js';
|
|
21
|
+
__init__global__()
|
|
22
|
+
class UIElement extends UINode{
|
|
23
|
+
constructor({element, name ='', type="html", useDefaultStyle=false}={}){
|
|
21
24
|
super()
|
|
22
25
|
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
|
|
23
26
|
if(typeof element === "string") {
|
|
24
|
-
switch(
|
|
27
|
+
switch(type){
|
|
25
28
|
case "html" : element = globalThis?.document?.createElement(element); break;
|
|
26
29
|
case "svg" : element = globalThis?.document?.createElementNS("http://www.w3.org/2000/svg", element);
|
|
27
30
|
default : throw Error("Not supported")
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
else{
|
|
31
|
-
this.target = element
|
|
34
|
+
this.target = element?.parentElement;
|
|
32
35
|
}
|
|
33
|
-
|
|
34
|
-
compose(
|
|
36
|
+
register(
|
|
35
37
|
this,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
AttrsMethods,
|
|
39
|
+
DomMethods,
|
|
40
|
+
StyleMethods,
|
|
41
|
+
IndexingMethods,
|
|
38
42
|
EventsMethodes
|
|
39
|
-
)
|
|
40
|
-
// if(false){
|
|
41
|
-
// import("../methods/tree.js").then(({ default: ExternalMethods }) => {
|
|
42
|
-
// compose(this, ExternalMethods);
|
|
43
|
-
// });
|
|
44
|
-
// }
|
|
43
|
+
);
|
|
45
44
|
Object.assign(this.cache, {
|
|
46
45
|
name,
|
|
47
46
|
isInteractive : [true, false][Math.floor(2*Math.random())],
|
|
@@ -51,7 +50,6 @@ class ZikoUIElement extends ZikoUINode{
|
|
|
51
50
|
isHidden: false,
|
|
52
51
|
isFrozzen:false,
|
|
53
52
|
legacyParent : null,
|
|
54
|
-
style: new ZikoUIElementStyle({}),
|
|
55
53
|
attributes: {},
|
|
56
54
|
filters: {},
|
|
57
55
|
temp:{}
|
|
@@ -76,7 +74,6 @@ class ZikoUIElement extends ZikoUINode{
|
|
|
76
74
|
if(element)Object.assign(this.cache,{element});
|
|
77
75
|
this.uuid = `${this.cache.name}-${Random.string(16)}`
|
|
78
76
|
this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
|
|
79
|
-
this.cache.style.linkTo(this);
|
|
80
77
|
useDefaultStyle && this.style({
|
|
81
78
|
position: "relative",
|
|
82
79
|
boxSizing:"border-box",
|
|
@@ -109,10 +106,6 @@ class ZikoUIElement extends ZikoUINode{
|
|
|
109
106
|
isZikoUIElement(){
|
|
110
107
|
return true;
|
|
111
108
|
}
|
|
112
|
-
register(){
|
|
113
|
-
|
|
114
|
-
return this;
|
|
115
|
-
}
|
|
116
109
|
get st(){
|
|
117
110
|
return this.cache.style;
|
|
118
111
|
}
|
|
@@ -162,25 +155,17 @@ class ZikoUIElement extends ZikoUINode{
|
|
|
162
155
|
else UI.element=this.element.cloneNode(true);
|
|
163
156
|
return UI.render(render);
|
|
164
157
|
}
|
|
165
|
-
style(styles){
|
|
166
|
-
styles instanceof ZikoUseStyle ? this.st.style(styles.current): this.st.style(styles);
|
|
167
|
-
return this;
|
|
168
|
-
}
|
|
169
|
-
size(width,height){
|
|
170
|
-
this.st.size(width,height);
|
|
171
|
-
return this;
|
|
172
|
-
}
|
|
173
158
|
[Symbol.iterator]() {
|
|
174
159
|
return this.items[Symbol.iterator]();
|
|
175
160
|
}
|
|
176
161
|
maintain() {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
162
|
+
for (let i = 0; i < this.items.length; i++) {
|
|
163
|
+
Object.defineProperty(this, i, {
|
|
164
|
+
value: this.items[i],
|
|
165
|
+
writable: true,
|
|
166
|
+
configurable: true,
|
|
167
|
+
enumerable: false
|
|
168
|
+
});
|
|
184
169
|
}
|
|
185
170
|
}
|
|
186
171
|
freeze(freeze){
|
|
@@ -198,43 +183,6 @@ class ZikoUIElement extends ZikoUINode{
|
|
|
198
183
|
describe(label){
|
|
199
184
|
if(label)this.setAttr("aria-label",label)
|
|
200
185
|
}
|
|
201
|
-
animate(keyframe, {duration=1000, iterations=1, easing="ease"}={}){
|
|
202
|
-
this.element?.animate(keyframe,{duration, iterations, easing});
|
|
203
|
-
return this;
|
|
204
|
-
}
|
|
205
|
-
// Attributes
|
|
206
|
-
#setAttr(name, value){
|
|
207
|
-
if(this.element?.tagName !== "svg") name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
|
|
208
|
-
if(this?.attr[name] && this?.attr[name]===value) return;
|
|
209
|
-
this.element?.setAttribute(name, value)
|
|
210
|
-
Object.assign(this.cache.attributes, {[name]:value});
|
|
211
|
-
}
|
|
212
|
-
setAttr(name, value) {
|
|
213
|
-
if(name instanceof Object){
|
|
214
|
-
const [names,values]=[Object.keys(name),Object.values(name)];
|
|
215
|
-
for(let i=0;i<names.length;i++){
|
|
216
|
-
if(values[i] instanceof Array)value[i] = values[i].join(" ");
|
|
217
|
-
this.#setAttr(names[i], values[i])
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
else{
|
|
221
|
-
if(value instanceof Array)value = value.join(" ");
|
|
222
|
-
this.#setAttr(name, value)
|
|
223
|
-
}
|
|
224
|
-
return this;
|
|
225
|
-
}
|
|
226
|
-
removeAttr(...names) {
|
|
227
|
-
for(let i=0;i<names.length;i++)this.element?.removeAttribute(names[i]);
|
|
228
|
-
return this;
|
|
229
|
-
}
|
|
230
|
-
getAttr(name){
|
|
231
|
-
name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
|
|
232
|
-
return this.element.attributes[name].value;
|
|
233
|
-
}
|
|
234
|
-
setContentEditable(bool = true) {
|
|
235
|
-
this.setAttr("contenteditable", bool);
|
|
236
|
-
return this;
|
|
237
|
-
}
|
|
238
186
|
get children() {
|
|
239
187
|
return [...this.element.children];
|
|
240
188
|
}
|
|
@@ -306,4 +254,4 @@ class ZikoUIElement extends ZikoUINode{
|
|
|
306
254
|
}
|
|
307
255
|
|
|
308
256
|
}
|
|
309
|
-
export default
|
|
257
|
+
export default UIElement;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default class
|
|
1
|
+
export default class UINode {
|
|
2
2
|
constructor(node){
|
|
3
3
|
this.cache = {
|
|
4
4
|
node
|
|
@@ -12,4 +12,4 @@ export default class ZikoUINode {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
globalThis.node = (node) => new
|
|
15
|
+
globalThis.node = (node) => new UINode(node);
|
package/src/ui/flex/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
class ZikoUIFlex extends
|
|
1
|
+
import UIElement from "../constructors/UIElement.js";
|
|
2
|
+
class ZikoUIFlex extends UIElement {
|
|
3
3
|
constructor(tag = "div", w = "100%", h = "100%") {
|
|
4
|
-
super(tag ,"Flex");
|
|
4
|
+
super({element : tag , name : "Flex"});
|
|
5
5
|
this.direction = "cols";
|
|
6
6
|
if (typeof w == "number") w += "%";
|
|
7
7
|
if (typeof h == "number") h += "%";
|
|
@@ -69,13 +69,13 @@ class ZikoUIFlex extends ZikoUIElement {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
const Flex = (...
|
|
72
|
+
const Flex = (...UIElement) =>{
|
|
73
73
|
let tag="div";
|
|
74
|
-
if(typeof
|
|
75
|
-
tag=
|
|
76
|
-
|
|
74
|
+
if(typeof UIElement[0]==="string"){
|
|
75
|
+
tag=UIElement[0];
|
|
76
|
+
UIElement.pop();
|
|
77
77
|
}
|
|
78
|
-
return new ZikoUIFlex(tag).append(...
|
|
78
|
+
return new ZikoUIFlex(tag).append(...UIElement);
|
|
79
79
|
}
|
|
80
80
|
function set_vertical(direction){
|
|
81
81
|
direction == 1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import UIElement from "../constructors/UIElement.js";
|
|
2
2
|
import {Matrix} from "../../math/matrix/Matrix.js"
|
|
3
|
-
class ZikoUICanvas extends
|
|
3
|
+
class ZikoUICanvas extends UIElement{
|
|
4
4
|
constructor(w,h){
|
|
5
5
|
super("canvas","canvas");
|
|
6
6
|
this.ctx = this.element?.getContext("2d");
|
package/src/ui/graphics/svg.js
CHANGED
package/src/ui/grid/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
class ZikoUIGrid extends
|
|
1
|
+
import UIElement from "../constructors/UIElement.js"
|
|
2
|
+
class ZikoUIGrid extends UIElement {
|
|
3
3
|
constructor(tag ="div", w = "50vw", h = "50vh") {
|
|
4
|
-
super(tag,"Grid");
|
|
4
|
+
super({element : tag, name : "Grid"});
|
|
5
5
|
this.direction = "cols";
|
|
6
6
|
if (typeof w == "number") w += "%";
|
|
7
7
|
if (typeof h == "number") h += "%";
|
|
@@ -29,5 +29,5 @@ class ZikoUIGrid extends ZikoUIElement {
|
|
|
29
29
|
return this;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
const Grid = (...
|
|
32
|
+
const Grid = (...UIElement) => new ZikoUIGrid("div").append(...UIElement);
|
|
33
33
|
export {Grid,ZikoUIGrid};
|
package/src/ui/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { default as
|
|
2
|
-
export { default as
|
|
1
|
+
export { default as UIElement } from "./constructors/UIElement.js"
|
|
2
|
+
export { default as UINode } from "./constructors/UINode.js"
|
|
3
3
|
export * from './tags/index.js';
|
|
4
4
|
export * from './text/index.js';
|
|
5
5
|
export * from './flex/index.js';
|
package/src/ui/suspense/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
class ZikoUISuspense extends
|
|
1
|
+
import UIElement from "../constructors/UIElement";
|
|
2
|
+
class ZikoUISuspense extends UIElement{
|
|
3
3
|
constructor(fallback_ui, callback){
|
|
4
|
-
super("div", "suspense")
|
|
4
|
+
super({element : "div", name : "suspense"})
|
|
5
5
|
this.setAttr({
|
|
6
6
|
dataTemp : "suspense"
|
|
7
7
|
})
|