ziko 0.0.12 → 0.0.13
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 +2896 -2290
- package/dist/ziko.js +2896 -2290
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +2888 -2290
- package/package.json +39 -12
- package/src/__helpers__/index.js +41 -0
- package/src/app/accessibility/index.js +0 -0
- package/src/app/app.js +46 -0
- package/src/app/component/index.js +38 -0
- package/src/app/globals/index.js +20 -0
- package/src/app/index.js +12 -0
- package/src/app/params/index.js +40 -0
- package/src/app/router/index.js +67 -0
- package/src/app/seo/index.js +43 -0
- package/src/app/themes/dark.js +885 -0
- package/src/app/themes/index.js +11 -0
- package/src/app/themes/light.js +255 -0
- package/src/data/api/fetchdom.js +14 -0
- package/src/data/api/index.js +4 -0
- package/src/data/api/preload.js +11 -0
- package/src/data/converter/adoc.js +130 -0
- package/src/data/converter/array.js +43 -0
- package/src/data/converter/canvas.js +25 -0
- package/src/data/converter/csv.js +33 -0
- package/src/data/converter/idea.txt +10 -0
- package/src/data/converter/index.js +34 -0
- package/src/data/converter/json.js +80 -0
- package/src/data/converter/markdown.js +95 -0
- package/src/data/converter/object.js +70 -0
- package/src/data/converter/svg.js +11 -0
- package/src/data/decorators.js +0 -0
- package/src/data/index.js +74 -0
- package/src/data/parser/markdown.js +0 -0
- package/src/data/parser/xml.js +47 -0
- package/src/data/string/index.js +1 -0
- package/src/data/string/patterns.js +12 -0
- package/src/data/string/string.js +170 -0
- package/src/graphics/canvas/_canvas_offscreen +0 -0
- package/src/graphics/canvas/canvas.js +189 -0
- package/src/graphics/canvas/elements/Basic/arc.js +43 -0
- package/src/graphics/canvas/elements/Basic/image.js +0 -0
- package/src/graphics/canvas/elements/Basic/line.js +26 -0
- package/src/graphics/canvas/elements/Basic/path.js +0 -0
- package/src/graphics/canvas/elements/Basic/points.js +48 -0
- package/src/graphics/canvas/elements/Basic/polygon.js +7 -0
- package/src/graphics/canvas/elements/Basic/polyline.js +0 -0
- package/src/graphics/canvas/elements/Basic/rect.js +46 -0
- package/src/graphics/canvas/elements/Basic/text.js +0 -0
- package/src/graphics/canvas/elements/Chart/histogram.js +0 -0
- package/src/graphics/canvas/elements/Chart/plot.js +0 -0
- package/src/graphics/canvas/elements/Chart/scatter.js +2 -0
- package/src/graphics/canvas/elements/Chart/stem.js +0 -0
- package/src/graphics/canvas/elements/Element.js +115 -0
- package/src/graphics/canvas/elements/Groupe.js +0 -0
- package/src/graphics/canvas/elements/grid.js +0 -0
- package/src/graphics/canvas/elements/index.js +13 -0
- package/src/graphics/canvas/filter/index.js +0 -0
- package/src/graphics/canvas/index.js +15 -0
- package/src/graphics/canvas/paint/index.js +0 -0
- package/src/graphics/canvas/utils/color.js +8 -0
- package/src/graphics/canvas/utils/floodFill.js +58 -0
- package/src/graphics/index.js +69 -0
- package/src/graphics/svg/Elements/Basic/circle.js +26 -0
- package/src/graphics/svg/Elements/Basic/ellipse.js +21 -0
- package/src/graphics/svg/Elements/Basic/foreignObject.js +33 -0
- package/src/graphics/svg/Elements/Basic/groupe.js +29 -0
- package/src/graphics/svg/Elements/Basic/image.js +33 -0
- package/src/graphics/svg/Elements/Basic/line.js +29 -0
- package/src/graphics/svg/Elements/Basic/link.js +30 -0
- package/src/graphics/svg/Elements/Basic/path.js +59 -0
- package/src/graphics/svg/Elements/Basic/polygon.js +32 -0
- package/src/graphics/svg/Elements/Basic/polyline.js +4 -0
- package/src/graphics/svg/Elements/Basic/rect.js +43 -0
- package/src/graphics/svg/Elements/Basic/text.js +26 -0
- package/src/graphics/svg/Elements/Derived/grid.js +9 -0
- package/src/graphics/svg/Elements/ZikoSvgElement.js +46 -0
- package/src/graphics/svg/Elements/index.js +14 -0
- package/src/graphics/svg/index.js +2 -0
- package/src/graphics/svg/svg.js +115 -0
- package/src/index.js +88 -0
- package/src/math/absract.js +1 -0
- package/src/math/calculus/index.js +1 -0
- package/src/math/calculus/special-functions/bessel.js +31 -0
- package/src/math/calculus/special-functions/beta.js +38 -0
- package/src/math/calculus/special-functions/gamma.js +30 -0
- package/src/math/calculus/special-functions/index.js +4 -0
- package/src/math/complex/Fractals/julia.js +0 -0
- package/src/math/complex/index.js +203 -0
- package/src/math/const.js +3 -0
- package/src/math/discret/Combinaison/index.js +34 -0
- package/src/math/discret/Conversion/index.js +86 -0
- package/src/math/discret/Logic/index.js +46 -0
- package/src/math/discret/Permutation/index.js +31 -0
- package/src/math/discret/Set/index.js +2 -0
- package/src/math/discret/Set/power-set.js +15 -0
- package/src/math/discret/Set/sub-set.js +10 -0
- package/src/math/discret/index.js +23 -0
- package/src/math/functions/index.js +182 -0
- package/src/math/index.js +189 -0
- package/src/math/matrix/Decomposition.js +90 -0
- package/src/math/matrix/LinearSystem.js +10 -0
- package/src/math/matrix/Matrix.js +717 -0
- package/src/math/matrix/index.js +3 -0
- package/src/math/numeric/index.js +0 -0
- package/src/math/random/index.js +173 -0
- package/src/math/signal/__np.py.txt +40 -0
- package/src/math/signal/conv.js +175 -0
- package/src/math/signal/fft.js +55 -0
- package/src/math/signal/filter.js +39 -0
- package/src/math/signal/functions.js +146 -0
- package/src/math/signal/index.js +110 -0
- package/src/math/statistics/Functions/index.js +100 -0
- package/src/math/statistics/index.js +16 -0
- package/src/math/utils/arithmetic.js +139 -0
- package/src/math/utils/checkers.js +29 -0
- package/src/math/utils/comparaison.js +1 -0
- package/src/math/utils/conversions.js +19 -0
- package/src/math/utils/discret.js +51 -0
- package/src/math/utils/index.js +102 -0
- package/src/math/utils/mapfun.js +50 -0
- package/src/reactivity/events/Global/Click.js +56 -0
- package/src/reactivity/events/Global/Clipboard.js +84 -0
- package/src/reactivity/events/Global/CustomEvent.js +53 -0
- package/src/reactivity/events/Global/Drag.js +137 -0
- package/src/reactivity/events/Global/Focus.js +56 -0
- package/src/reactivity/events/Global/Key.js +104 -0
- package/src/reactivity/events/Global/Mouse.js +230 -0
- package/src/reactivity/events/Global/Pointer.js +234 -0
- package/src/reactivity/events/Global/Swipe.js +147 -0
- package/src/reactivity/events/Global/Touch.js +0 -0
- package/src/reactivity/events/Global/Wheel.js +44 -0
- package/src/reactivity/events/Partiel/Hash.js +44 -0
- package/src/reactivity/events/Partiel/Input.js +59 -0
- package/src/reactivity/events/Partiel/Media.js +1 -0
- package/src/reactivity/events/ZikoEvent.js +91 -0
- package/src/reactivity/events/index.js +63 -0
- package/src/reactivity/hooks/Contexte/index.js +1 -0
- package/src/reactivity/hooks/Contexte/useSuccesifKeys.js +14 -0
- package/src/reactivity/hooks/Decorators/index.js +6 -0
- package/src/reactivity/hooks/Decorators/time.js +17 -0
- package/src/reactivity/hooks/Decorators/type.js +88 -0
- package/src/reactivity/hooks/Interactions/index.js +4 -0
- package/src/reactivity/hooks/Interactions/useBluetooth.js +48 -0
- package/src/reactivity/hooks/Interactions/useChannel.js +50 -0
- package/src/reactivity/hooks/Interactions/useEventEmmiter.js +64 -0
- package/src/reactivity/hooks/Interactions/useSerial.js +0 -0
- package/src/reactivity/hooks/Interactions/useThread.js +44 -0
- package/src/reactivity/hooks/Interactions/useUsb.js +0 -0
- package/src/reactivity/hooks/Sensors/index.js +2 -0
- package/src/reactivity/hooks/Sensors/useBattery.js +36 -0
- package/src/reactivity/hooks/Sensors/useCamera.js +0 -0
- package/src/reactivity/hooks/Sensors/useGeolocation.js +17 -0
- package/src/reactivity/hooks/Sensors/useMicro.js +0 -0
- package/src/reactivity/hooks/Sensors/useOrientation.js +0 -0
- package/src/reactivity/hooks/Storage/index.js +1 -0
- package/src/reactivity/hooks/Storage/useCookie.js +0 -0
- package/src/reactivity/hooks/Storage/useIndexedDb.js +0 -0
- package/src/reactivity/hooks/Storage/useStorage.js +73 -0
- package/src/reactivity/hooks/UI/index.js +5 -0
- package/src/reactivity/hooks/UI/useCssLink.js +0 -0
- package/src/reactivity/hooks/UI/useCssText.js +21 -0
- package/src/reactivity/hooks/UI/useFavIcon.js +38 -0
- package/src/reactivity/hooks/UI/useLinearGradient.js +0 -0
- package/src/reactivity/hooks/UI/useMediaQuery.js +43 -0
- package/src/reactivity/hooks/UI/useRadialGradient.js +0 -0
- package/src/reactivity/hooks/UI/useStyle.js +79 -0
- package/src/reactivity/hooks/UI/useTheme.js +62 -0
- package/src/reactivity/hooks/UI/useTitle.js +30 -0
- package/src/reactivity/hooks/index.js +85 -0
- package/src/reactivity/hooks/todo.md +26 -0
- package/src/reactivity/idea +2 -0
- package/src/reactivity/index.js +22 -0
- package/src/reactivity/observer/attributes.js +28 -0
- package/src/reactivity/observer/children.js +37 -0
- package/src/reactivity/observer/index.js +44 -0
- package/src/reactivity/observer/intersection.js +44 -0
- package/src/reactivity/observer/mutation.js +113 -0
- package/src/reactivity/observer/resize.js +47 -0
- package/src/reactivity/observer/screen.js +45 -0
- package/src/reactivity/observer/screen.js.txt +84 -0
- package/src/reactivity/observer/screen.txt +13 -0
- package/src/time/animation.js +76 -0
- package/src/time/index.js +54 -0
- package/src/time/loop.js +87 -0
- package/src/time/utils/decorators.js +17 -0
- package/src/time/utils/ease.js +144 -0
- package/src/time/utils/index.js +18 -0
- package/src/time/utils/performance.js +16 -0
- package/src/time/utils/ui.js +26 -0
- package/src/user-interface/elements/derived/Flex.js +103 -0
- package/src/user-interface/elements/derived/Grid.js +33 -0
- package/src/user-interface/elements/derived/elements/Notification.js +0 -0
- package/src/user-interface/elements/derived/elements/Popover.js +0 -0
- package/src/user-interface/elements/derived/elements/Popup.js +0 -0
- package/src/user-interface/elements/derived/elements/Swipper.js +4 -0
- package/src/user-interface/elements/derived/elements/Timeline.js +0 -0
- package/src/user-interface/elements/derived/elements/Toast.js +0 -0
- package/src/user-interface/elements/derived/elements/Treeview.js +0 -0
- package/src/user-interface/elements/derived/elements/accordion/accordion.js +45 -0
- package/src/user-interface/elements/derived/elements/accordion/collapsible.js +82 -0
- package/src/user-interface/elements/derived/elements/accordion/index.js +2 -0
- package/src/user-interface/elements/derived/elements/alert/alert.js +80 -0
- package/src/user-interface/elements/derived/elements/alert/index.js +1 -0
- package/src/user-interface/elements/derived/elements/alert/palette.js +52 -0
- package/src/user-interface/elements/derived/elements/carousel/index.js +50 -0
- package/src/user-interface/elements/derived/elements/code-note/SubElements.js.txt +105 -0
- package/src/user-interface/elements/derived/elements/code-note/code-cell.js +195 -0
- package/src/user-interface/elements/derived/elements/code-note/code-note.js +72 -0
- package/src/user-interface/elements/derived/elements/code-note/index.js +2 -0
- package/src/user-interface/elements/derived/elements/code-note/sub-elements.js +67 -0
- package/src/user-interface/elements/derived/elements/columns.js +1 -0
- package/src/user-interface/elements/derived/elements/fab.js +0 -0
- package/src/user-interface/elements/derived/elements/index.js +9 -0
- package/src/user-interface/elements/derived/elements/menu/index.js +1 -0
- package/src/user-interface/elements/derived/elements/menu/menu3d.js +260 -0
- package/src/user-interface/elements/derived/elements/modal/index.js +92 -0
- package/src/user-interface/elements/derived/elements/pagination/breadcrumbs.js +54 -0
- package/src/user-interface/elements/derived/elements/pagination/index.js +1 -0
- package/src/user-interface/elements/derived/elements/splitter/__ZikoUISplitter__.js +62 -0
- package/src/user-interface/elements/derived/elements/splitter/hsplitter.js +40 -0
- package/src/user-interface/elements/derived/elements/splitter/index.js +2 -0
- package/src/user-interface/elements/derived/elements/splitter/vsplitter.js +40 -0
- package/src/user-interface/elements/derived/elements/tabs/index.js +180 -0
- package/src/user-interface/elements/derived/index.js +3 -0
- package/src/user-interface/elements/primitives/ZikoUIContainerElement.js +127 -0
- package/src/user-interface/elements/primitives/ZikoUIElement.js +478 -0
- package/src/user-interface/elements/primitives/embaded/index.js +1 -0
- package/src/user-interface/elements/primitives/index.js +8 -0
- package/src/user-interface/elements/primitives/io/Form/index.js +42 -0
- package/src/user-interface/elements/primitives/io/Form/index.js.txt +104 -0
- package/src/user-interface/elements/primitives/io/Inputs/__helpers__.js +52 -0
- package/src/user-interface/elements/primitives/io/Inputs/index.js +12 -0
- package/src/user-interface/elements/primitives/io/Inputs/input/index.js +98 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-camera/index.js +26 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-checkbox/index.js +26 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-color/index.js +16 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-date-time/index.js +3 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-date-time.js +14 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-date.js +14 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-time.js +14 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-email-password/index.js +2 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-email-password/input-email.js +15 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-email-password/input-password.js +14 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-file/index.js +1 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-file/input-file.js +0 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-file/input-image.js +43 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-number/index.js +37 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-radio/index.js +26 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-search/index.js +45 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-slider/index.js +34 -0
- package/src/user-interface/elements/primitives/io/Select/index.js +20 -0
- package/src/user-interface/elements/primitives/io/Textarea/index.js +18 -0
- package/src/user-interface/elements/primitives/io/index.js +4 -0
- package/src/user-interface/elements/primitives/list/elements.js +0 -0
- package/src/user-interface/elements/primitives/list/index.js +139 -0
- package/src/user-interface/elements/primitives/media/Audio/index.js +17 -0
- package/src/user-interface/elements/primitives/media/Image/figure.js +19 -0
- package/src/user-interface/elements/primitives/media/Image/image.js +36 -0
- package/src/user-interface/elements/primitives/media/Image/index.js +2 -0
- package/src/user-interface/elements/primitives/media/Video/index.js +27 -0
- package/src/user-interface/elements/primitives/media/__ZikoUIDynamicMediaELement__.js +47 -0
- package/src/user-interface/elements/primitives/media/index.js +3 -0
- package/src/user-interface/elements/primitives/misc/index.js +99 -0
- package/src/user-interface/elements/primitives/semantic/index.js +82 -0
- package/src/user-interface/elements/primitives/table/elements.js +94 -0
- package/src/user-interface/elements/primitives/table/index.js +3 -0
- package/src/user-interface/elements/primitives/table/table.js +115 -0
- package/src/user-interface/elements/primitives/table/utils.js +12 -0
- package/src/user-interface/elements/primitives/text/__ZikoUIText__.js +71 -0
- package/src/user-interface/elements/primitives/text/heading.js +36 -0
- package/src/user-interface/elements/primitives/text/index.js +3 -0
- package/src/user-interface/elements/primitives/text/p.js +26 -0
- package/src/user-interface/elements/primitives/text/pre.js +0 -0
- package/src/user-interface/elements/primitives/text/text.js +81 -0
- package/src/user-interface/index.js +188 -0
- package/src/user-interface/style/index.js +510 -0
- package/src/user-interface/utils/index.js +70 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
class ZikoUseStyle {
|
|
2
|
+
constructor(style = {}, use = style.hasOwnProperty("default")? "default" : Object.keys(style)[0], id = 0) {
|
|
3
|
+
this.id = "Ziko-Style-" + id;
|
|
4
|
+
this.keys = new Set();
|
|
5
|
+
this.styles = {
|
|
6
|
+
default: {
|
|
7
|
+
fontSize: "1em",
|
|
8
|
+
color : "green"
|
|
9
|
+
},
|
|
10
|
+
other: {
|
|
11
|
+
fontSize : "2em",
|
|
12
|
+
color : "cyan"
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
style && this.add(style);
|
|
16
|
+
use && this.use(use);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get current() {
|
|
20
|
+
return [...this.keys].reduce((key, value) => {
|
|
21
|
+
key[value] = `var(--${value}-${this.id})`;
|
|
22
|
+
return key;
|
|
23
|
+
}, {});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
add(name, style = {}) {
|
|
27
|
+
if (name && typeof name === 'object' && !Array.isArray(name)) {
|
|
28
|
+
Object.assign(this.styles, name);
|
|
29
|
+
} else if (typeof name === 'string') {
|
|
30
|
+
Object.assign(this.styles, { [name]: style });
|
|
31
|
+
}
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
#useStyleIndex(index) {
|
|
36
|
+
const keys = Object.keys(this.styles);
|
|
37
|
+
for (let a in this.styles[keys[index]]) {
|
|
38
|
+
if (Object.prototype.hasOwnProperty.call(this.styles[keys[index]], a)) {
|
|
39
|
+
document.documentElement.style.setProperty(`--${a}-${this.id}`, this.styles[keys[index]][a]);
|
|
40
|
+
this.keys.add(a);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
#useStyleName(name) {
|
|
47
|
+
if (!this.styles[name]) return this;
|
|
48
|
+
for (let a in this.styles[name]) {
|
|
49
|
+
if (Object.prototype.hasOwnProperty.call(this.styles[name], a)) {
|
|
50
|
+
document.documentElement.style.setProperty(`--${a}-${this.id}`, this.styles[name][a]);
|
|
51
|
+
this.keys.add(a);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
#useStyleObject(style) {
|
|
58
|
+
for (let a in style) {
|
|
59
|
+
if (Object.prototype.hasOwnProperty.call(style, a)) {
|
|
60
|
+
document.documentElement.style.setProperty(`--${a}-${this.id}`, style[a]);
|
|
61
|
+
this.keys.add(a);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
use(style) {
|
|
68
|
+
if (typeof style === "number") return this.#useStyleIndex(style);
|
|
69
|
+
if (typeof style === "string") return this.#useStyleName(style);
|
|
70
|
+
if (style && typeof style === "object") return this.#useStyleObject(style);
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const useStyle = (styles, use, id) => new ZikoUseStyle(styles, use, id)
|
|
76
|
+
export {
|
|
77
|
+
useStyle,
|
|
78
|
+
ZikoUseStyle
|
|
79
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Themes } from "../../../app/themes";
|
|
2
|
+
class ZikoUseTheme{
|
|
3
|
+
constructor(theme,id=0){
|
|
4
|
+
this.id="Ziko-Theme-"+id;
|
|
5
|
+
this.use(theme)
|
|
6
|
+
}
|
|
7
|
+
get current(){
|
|
8
|
+
const colorNames = [
|
|
9
|
+
'background',
|
|
10
|
+
'currentLine',
|
|
11
|
+
'selection',
|
|
12
|
+
'foreground',
|
|
13
|
+
'comment',
|
|
14
|
+
'cyan',
|
|
15
|
+
'green',
|
|
16
|
+
'orange',
|
|
17
|
+
'pink',
|
|
18
|
+
'purple',
|
|
19
|
+
'red',
|
|
20
|
+
'yellow',
|
|
21
|
+
];
|
|
22
|
+
return colorNames.reduce((theme, color) => {
|
|
23
|
+
theme[color] = `var(--${color}-${this.id})`;
|
|
24
|
+
return theme;
|
|
25
|
+
}, {});
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
useThemeIndex(index){
|
|
29
|
+
const keys=Object.keys(Themes);
|
|
30
|
+
for(let a in Themes[keys[index]]){
|
|
31
|
+
document.documentElement.style.setProperty(`--${a}-${this.id}`, Themes[keys[index]][a]);
|
|
32
|
+
}
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
useThemeName(str){
|
|
36
|
+
str=str.toLowerCase()
|
|
37
|
+
const Themes_With_Lower_Case=Object.fromEntries(Object.entries(Themes).map(n=>[n[0].toLowerCase(),n[1]]))
|
|
38
|
+
for(let a in Themes_With_Lower_Case[str]){
|
|
39
|
+
document.documentElement.style.setProperty(`--${a}-${this.id}`, Themes_With_Lower_Case[str][a]);
|
|
40
|
+
}
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
useThemeObject(Theme){
|
|
44
|
+
for(let a in Theme){
|
|
45
|
+
document.documentElement.style.setProperty(`--${a}-${this.id}`, Theme[a]);
|
|
46
|
+
}
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
use(theme){
|
|
50
|
+
if(typeof theme === "number")this.useThemeIndex(theme);
|
|
51
|
+
if(typeof theme === "string")this.useThemeName(theme);
|
|
52
|
+
if(theme instanceof Object)this.useThemeObject(theme);
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const useTheme=(theme, id=0)=>new ZikoUseTheme(theme,id)
|
|
57
|
+
export {
|
|
58
|
+
useTheme,
|
|
59
|
+
// Themes,
|
|
60
|
+
// LightThemes,
|
|
61
|
+
// DarkThemes,
|
|
62
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEventEmitter } from "../Interactions/useEventEmmiter";
|
|
2
|
+
class ZikoUseTitle{
|
|
3
|
+
constructor(title=document.title,useEventEmitter=true){
|
|
4
|
+
this.cache={
|
|
5
|
+
Emitter:null
|
|
6
|
+
}
|
|
7
|
+
if(useEventEmitter)this.useEventEmitter();
|
|
8
|
+
this.set(title);
|
|
9
|
+
}
|
|
10
|
+
useEventEmitter(){
|
|
11
|
+
this.cache.Emitter=useEventEmitter();
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
set(title){
|
|
15
|
+
if(title!==document.title){
|
|
16
|
+
document.title=title;
|
|
17
|
+
if(this.cache.Emitter)this.cache.Emitter.emit("ziko:title-changed");
|
|
18
|
+
}
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
get current(){
|
|
22
|
+
return document.title;
|
|
23
|
+
}
|
|
24
|
+
onChange(callback){
|
|
25
|
+
if(this.cache.Emitter)this.cache.Emitter.on("ziko:title-changed",callback);
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const useTitle=(title, useEventEmitter)=>new ZikoUseTitle(title, useEventEmitter);
|
|
30
|
+
export{ useTitle }
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useStyle,
|
|
3
|
+
useTheme,
|
|
4
|
+
useTitle,
|
|
5
|
+
useFavIcon,
|
|
6
|
+
useMediaQuery
|
|
7
|
+
} from "./UI";
|
|
8
|
+
import {
|
|
9
|
+
useEventEmitter,
|
|
10
|
+
useChannel,
|
|
11
|
+
useThread,
|
|
12
|
+
useBluetooth
|
|
13
|
+
} from "./Interactions";
|
|
14
|
+
import {
|
|
15
|
+
useBattery,
|
|
16
|
+
useGeolocation
|
|
17
|
+
} from "./Sensors";
|
|
18
|
+
import {
|
|
19
|
+
useThrottle,
|
|
20
|
+
useDebounce
|
|
21
|
+
} from "./Decorators";
|
|
22
|
+
import {
|
|
23
|
+
useLocaleStorage,
|
|
24
|
+
useSessionStorage
|
|
25
|
+
} from "./Storage"
|
|
26
|
+
import {
|
|
27
|
+
useSuccesifKeys
|
|
28
|
+
} from "./Contexte";
|
|
29
|
+
const Hooks={
|
|
30
|
+
useStyle,
|
|
31
|
+
useTheme,
|
|
32
|
+
useMediaQuery,
|
|
33
|
+
useBattery,
|
|
34
|
+
useGeolocation,
|
|
35
|
+
useEventEmitter,
|
|
36
|
+
useChannel,
|
|
37
|
+
useThread,
|
|
38
|
+
useBluetooth,
|
|
39
|
+
useTitle,
|
|
40
|
+
useFavIcon,
|
|
41
|
+
useThrottle,
|
|
42
|
+
useDebounce,
|
|
43
|
+
useLocaleStorage,
|
|
44
|
+
useSessionStorage,
|
|
45
|
+
useSuccesifKeys,
|
|
46
|
+
ExtractAll: function () {
|
|
47
|
+
const keys = Object.keys(this);
|
|
48
|
+
for (let i = 0; i < keys.length; i++) {
|
|
49
|
+
const key = keys[i];
|
|
50
|
+
if (key !== 'ExtractAll' && key !== 'RemoveAll') {
|
|
51
|
+
globalThis[key] = this[key];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return this;
|
|
55
|
+
},
|
|
56
|
+
RemoveAll: function () {
|
|
57
|
+
const keys = Object.keys(this);
|
|
58
|
+
for (let i = 0; i < keys.length; i++) {
|
|
59
|
+
const key = keys[i];
|
|
60
|
+
if (key !== 'RemoveAll') {
|
|
61
|
+
delete globalThis[key];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export default Hooks;
|
|
68
|
+
export{
|
|
69
|
+
useStyle,
|
|
70
|
+
useTheme,
|
|
71
|
+
useMediaQuery,
|
|
72
|
+
useTitle,
|
|
73
|
+
useFavIcon,
|
|
74
|
+
useBattery,
|
|
75
|
+
useGeolocation,
|
|
76
|
+
useEventEmitter,
|
|
77
|
+
useChannel,
|
|
78
|
+
useThread,
|
|
79
|
+
useBluetooth,
|
|
80
|
+
useThrottle,
|
|
81
|
+
useDebounce,
|
|
82
|
+
useLocaleStorage,
|
|
83
|
+
useSessionStorage,
|
|
84
|
+
useSuccesifKeys
|
|
85
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
- Device :
|
|
2
|
+
- useBattery
|
|
3
|
+
- useGeolocation
|
|
4
|
+
- useFullScrean
|
|
5
|
+
- useOrientation
|
|
6
|
+
- useNotification
|
|
7
|
+
- UI
|
|
8
|
+
- useTheme
|
|
9
|
+
- useStyle
|
|
10
|
+
- useCss
|
|
11
|
+
- useTitle
|
|
12
|
+
- useFavIcon
|
|
13
|
+
- Interactions
|
|
14
|
+
- useEventEmitter
|
|
15
|
+
- useChannel
|
|
16
|
+
- useBluetooth
|
|
17
|
+
- useSerial
|
|
18
|
+
- useUsb
|
|
19
|
+
- useSocket
|
|
20
|
+
- Storage
|
|
21
|
+
- useSessionStorage
|
|
22
|
+
- useLocalStorage
|
|
23
|
+
- Timing
|
|
24
|
+
- useDebounce
|
|
25
|
+
- useThrottle
|
|
26
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Events from "./events";
|
|
2
|
+
import Observer from "./observer"
|
|
3
|
+
import Hooks from "./hooks"
|
|
4
|
+
const Reactivity={
|
|
5
|
+
Events,
|
|
6
|
+
Observer,
|
|
7
|
+
Hooks,
|
|
8
|
+
ExtractAll: function () {
|
|
9
|
+
this.Events.ExtractAll();
|
|
10
|
+
this.Observer.ExtractAll();
|
|
11
|
+
this.Hooks.ExtractAll();
|
|
12
|
+
},
|
|
13
|
+
RemoveAll: function () {
|
|
14
|
+
this.Events.RemoveAll();
|
|
15
|
+
this.Observer.RemoveAll();
|
|
16
|
+
this.Hooks.RemoveAll();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export * from "./events";
|
|
20
|
+
export * from "./observer";
|
|
21
|
+
export * from "./hooks";
|
|
22
|
+
export default Reactivity;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ZikoMutationObserver } from "./mutation";
|
|
2
|
+
class ZikoWatchAttr extends ZikoMutationObserver{
|
|
3
|
+
constructor(targetUIElement,callback){
|
|
4
|
+
super(targetUIElement,{ attributes: true, childList: false, subtree: false });
|
|
5
|
+
Object.assign(this.cache,{
|
|
6
|
+
observeCallback : (mutationsList, observer) =>{
|
|
7
|
+
for (const mutation of mutationsList) {
|
|
8
|
+
this.cache.lastMutation = {
|
|
9
|
+
name : mutation.attributeName,
|
|
10
|
+
value : mutation.target.getAttribute(mutation.attributeName)
|
|
11
|
+
}
|
|
12
|
+
if (this.cache.streamingEnabled) this.cache.mutationHistory.attributes.push(this.cache.lastMutation)
|
|
13
|
+
}
|
|
14
|
+
if (this.callback) this.callback(mutationsList, observer);
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
this.cache.mutationHistory.attributes = []
|
|
18
|
+
if(callback)this.observe(callback);
|
|
19
|
+
}
|
|
20
|
+
get history(){
|
|
21
|
+
return this.cache.mutationHistory.attributes;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const watchAttr=(targetUIElement, callback)=>new ZikoWatchAttr(targetUIElement, callback);
|
|
25
|
+
export{
|
|
26
|
+
watchAttr
|
|
27
|
+
}
|
|
28
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ZikoMutationObserver } from "./mutation";
|
|
2
|
+
class ZikoWatchChildren extends ZikoMutationObserver{
|
|
3
|
+
constructor(targetUIElement,callback){
|
|
4
|
+
super(targetUIElement,{ attributes: false, childList: true, subtree: false });
|
|
5
|
+
Object.assign(this.cache,{
|
|
6
|
+
observeCallback : (mutationsList, observer) =>{
|
|
7
|
+
for (const mutation of mutationsList) {
|
|
8
|
+
if(mutation.addedNodes)this.cache.lastMutation = {
|
|
9
|
+
type : "add",
|
|
10
|
+
item : this.target.find(n=>n.element === mutation.addedNodes[0])[0],
|
|
11
|
+
previous : this.target.find(n=>n.element === mutation.previousSibling)[0]
|
|
12
|
+
}
|
|
13
|
+
else if(mutation.addedNodes)this.cache.lastMutation = {
|
|
14
|
+
type : "remove",
|
|
15
|
+
item : this.target.find(n=>n.element === mutation.removedNodes[0])[0],
|
|
16
|
+
previous : this.target.find(n=>n.element === mutation.previousSibling)[0]
|
|
17
|
+
}
|
|
18
|
+
if (this.cache.streamingEnabled) this.cache.mutationHistory.children.push(this.cache.lastMutation)
|
|
19
|
+
}
|
|
20
|
+
if (this.callback) this.callback(mutationsList, observer);
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
this.cache.mutationHistory.children = []
|
|
24
|
+
if(callback)this.observe(callback);
|
|
25
|
+
}
|
|
26
|
+
get item(){
|
|
27
|
+
return this.cache.lastMutation.item;
|
|
28
|
+
}
|
|
29
|
+
get history(){
|
|
30
|
+
return this.cache.mutationHistory.children;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const watchChildren=(targetUIElement, callback)=>new ZikoWatchChildren(targetUIElement, callback);
|
|
35
|
+
export{
|
|
36
|
+
watchChildren
|
|
37
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { watchIntersection } from "./intersection.js";
|
|
2
|
+
import {
|
|
3
|
+
watch,
|
|
4
|
+
// watchAttr,
|
|
5
|
+
// watchChildren
|
|
6
|
+
} from "./mutation.js";
|
|
7
|
+
import { watchSize } from "./resize.js";
|
|
8
|
+
import { watchScreen } from "./screen.js";
|
|
9
|
+
import { watchAttr } from "./attributes.js";
|
|
10
|
+
import { watchChildren } from "./children.js";
|
|
11
|
+
const Observer={
|
|
12
|
+
watch,
|
|
13
|
+
watchAttr,
|
|
14
|
+
watchChildren,
|
|
15
|
+
watchIntersection,
|
|
16
|
+
watchSize,
|
|
17
|
+
watchScreen,
|
|
18
|
+
ExtractAll: function () {
|
|
19
|
+
const keys = Object.keys(this);
|
|
20
|
+
for (let i = 0; i < keys.length; i++) {
|
|
21
|
+
const key = keys[i];
|
|
22
|
+
if (key !== 'ExtractAll' && key !== 'RemoveAll') {
|
|
23
|
+
globalThis[key] = this[key];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return this;
|
|
27
|
+
},
|
|
28
|
+
RemoveAll: function () {
|
|
29
|
+
const keys = Object.keys(this);
|
|
30
|
+
for (let i = 0; i < keys.length; i++) {
|
|
31
|
+
const key = keys[i];
|
|
32
|
+
if (key !== 'RemoveAll') {
|
|
33
|
+
delete globalThis[key];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export * from "./intersection.js";
|
|
40
|
+
export * from "./attributes.js";
|
|
41
|
+
export * from "./children.js";
|
|
42
|
+
export * from "./resize.js";
|
|
43
|
+
export * from "./screen.js";
|
|
44
|
+
export default Observer;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
class ZikoIntersectionObserver{
|
|
2
|
+
constructor(UIElement,callback,{threshold=0,margin=0}={}){
|
|
3
|
+
this.target=UIElement;
|
|
4
|
+
this.config={
|
|
5
|
+
threshold,
|
|
6
|
+
margin
|
|
7
|
+
}
|
|
8
|
+
if(!globalThis.IntersectionObserver){
|
|
9
|
+
console.log("IntersectionObserver Nor Supported")
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
this.observer=new IntersectionObserver((entries)=>{
|
|
13
|
+
this.entrie=entries[0];
|
|
14
|
+
callback(this)
|
|
15
|
+
},{
|
|
16
|
+
threshold:this.threshold,
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
get ratio(){
|
|
20
|
+
return this.entrie.intersectionRatio;
|
|
21
|
+
}
|
|
22
|
+
get isIntersecting(){
|
|
23
|
+
return this.entrie.isIntersecting;
|
|
24
|
+
}
|
|
25
|
+
setThreshould(threshold){
|
|
26
|
+
this.config.threshold=threshold;
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
setMargin(margin){
|
|
30
|
+
margin=(typeof margin === "number")?margin+"px":margin;
|
|
31
|
+
this.config.margin=margin;
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
start(){
|
|
35
|
+
this.observer.observe(this.target.element);
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
stop(){
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const watchIntersection=(UI,callback,config)=>new ZikoIntersectionObserver(UI,callback,config);
|
|
44
|
+
export {watchIntersection}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
class ZikoMutationObserver {
|
|
2
|
+
constructor(targetUIElement, options) {
|
|
3
|
+
this.target = targetUIElement;
|
|
4
|
+
this.observer = null;
|
|
5
|
+
this.cache = {
|
|
6
|
+
options : options || { attributes: true, childList: true, subtree: true },
|
|
7
|
+
streamingEnabled : true,
|
|
8
|
+
lastMutation : null,
|
|
9
|
+
mutationHistory : {
|
|
10
|
+
// attributes: [],
|
|
11
|
+
// childList: [],
|
|
12
|
+
// subtree: [],
|
|
13
|
+
},
|
|
14
|
+
}
|
|
15
|
+
// children to Items : a.items.filter(n=>n.element === a[0].element)
|
|
16
|
+
this.observeCallback = (mutationsList, observer) => {
|
|
17
|
+
// if(this.cache.lastUpdatedAttr){
|
|
18
|
+
// this.cache.lastUpdatedAttr = mutation.target.getAttribute(mutation.attributeName)
|
|
19
|
+
// }
|
|
20
|
+
if (this.cache.streamingEnabled) {
|
|
21
|
+
for (const mutation of mutationsList) {
|
|
22
|
+
switch(mutation.type){
|
|
23
|
+
case 'attributes':this.cache.mutationHistory.attributes.push(mutation.target.getAttribute(mutation.attributeName));break;
|
|
24
|
+
case 'childList':this.cache.mutationHistory.childList.push(mutation);break;
|
|
25
|
+
case 'subtree':this.cache.mutationHistory.subtree.push(mutation);break;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (this.callback) {
|
|
30
|
+
this.callback(mutationsList, observer);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
observe(callback) {
|
|
36
|
+
if(!this.observer) {
|
|
37
|
+
if(!globalThis.MutationObserver) {
|
|
38
|
+
console.log("MutationObserver Nor Supported")
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
this.observer = new MutationObserver(this.cache.observeCallback);
|
|
42
|
+
this.observer.observe(this.target.element, this.cache.options);
|
|
43
|
+
// this.callback = ([e]) => callback.call(e,this.target);
|
|
44
|
+
this.callback = ([e]) => callback.call(e, this);
|
|
45
|
+
this.cache.streamingEnabled = true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
pause(options) {
|
|
50
|
+
if (this.observer) {
|
|
51
|
+
this.observer.disconnect();
|
|
52
|
+
if (options) {
|
|
53
|
+
this.observer.observe(this.target, options);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
reset(options) {
|
|
59
|
+
if (this.observer) {
|
|
60
|
+
this.observer.disconnect();
|
|
61
|
+
this.observer.observe(this.target, options || this.cache.options);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
clear() {
|
|
66
|
+
if (this.observer) {
|
|
67
|
+
this.observer.disconnect();
|
|
68
|
+
this.observer = null;
|
|
69
|
+
this.cache.mutationHistory = {
|
|
70
|
+
attributes: [],
|
|
71
|
+
childList: [],
|
|
72
|
+
subtree: [],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
this.cache.streamingEnabled = false;
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
getMutationHistory() {
|
|
80
|
+
return this.cache.mutationHistory;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
enableStreaming() {
|
|
84
|
+
this.cache.streamingEnabled = true;
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
disableStreaming() {
|
|
89
|
+
this.cache.streamingEnabled = false;
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
const watch=(targetUIElement,options={},callback=null)=>{
|
|
97
|
+
const Observer= new ZikoMutationObserver(targetUIElement,options);
|
|
98
|
+
if(callback)Observer.observe(callback);
|
|
99
|
+
return Observer
|
|
100
|
+
}
|
|
101
|
+
// const watchAttr = (targetUIElement, callback = null) => {
|
|
102
|
+
// const options = { attributes: true, childList: false, subtree: false };
|
|
103
|
+
// return watch(targetUIElement, options, ([e])=>callback.call(e,targetUIElement));
|
|
104
|
+
// };
|
|
105
|
+
// const watchAttr = (targetUIElement, callback = null) => {
|
|
106
|
+
// const options = { attributes: true, childList: false, subtree: false };
|
|
107
|
+
// return watch(targetUIElement, options, callback);
|
|
108
|
+
// };
|
|
109
|
+
|
|
110
|
+
export {
|
|
111
|
+
ZikoMutationObserver,
|
|
112
|
+
watch,
|
|
113
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
class ZikoResizeObserver{
|
|
2
|
+
constructor(UIElement,callback){
|
|
3
|
+
this.target=UIElement;
|
|
4
|
+
this.contentRect=null;
|
|
5
|
+
this.observer=new ResizeObserver(()=>{
|
|
6
|
+
callback(this)
|
|
7
|
+
})
|
|
8
|
+
}
|
|
9
|
+
get BoundingRect(){
|
|
10
|
+
return this.target.element.getBoundingClientRect();
|
|
11
|
+
}
|
|
12
|
+
get width(){
|
|
13
|
+
return this.BoundingRect.width;
|
|
14
|
+
}
|
|
15
|
+
get height(){
|
|
16
|
+
return this.BoundingRect.height;
|
|
17
|
+
}
|
|
18
|
+
get top(){
|
|
19
|
+
return this.BoundingRect.top;
|
|
20
|
+
}
|
|
21
|
+
get bottom(){
|
|
22
|
+
return this.BoundingRect.bottom;
|
|
23
|
+
}
|
|
24
|
+
get right(){
|
|
25
|
+
return this.BoundingRect.right;
|
|
26
|
+
}
|
|
27
|
+
get left(){
|
|
28
|
+
return this.BoundingRect.left;
|
|
29
|
+
}
|
|
30
|
+
get x(){
|
|
31
|
+
return this.BoundingRect.x;
|
|
32
|
+
}
|
|
33
|
+
get y(){
|
|
34
|
+
return this.BoundingRect.y;
|
|
35
|
+
}
|
|
36
|
+
start(){
|
|
37
|
+
this.observer.observe(this.target.element);
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
stop(){
|
|
41
|
+
this.observer.unobserve(this.target.element);
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const watchSize=(UI,callback)=>new ZikoResizeObserver(UI,callback)
|
|
47
|
+
export {watchSize}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { map } from "../../math/utils/index.js"
|
|
2
|
+
class ZikoScreenObserver {
|
|
3
|
+
constructor(callback=e=>console.log({x:e.x,y:e.y})) {
|
|
4
|
+
this.cache={};
|
|
5
|
+
this.previousX = globalThis?.screenX;
|
|
6
|
+
this.previousY = globalThis?.screenY;
|
|
7
|
+
}
|
|
8
|
+
update(){
|
|
9
|
+
Object.assign(this.cache,{
|
|
10
|
+
screenXLeft : globalThis?.screenX, // CORRECT
|
|
11
|
+
screenXRight : globalThis?.screen.availWidth - globalThis?.screenX, // CORRECT
|
|
12
|
+
screenYTop : globalThis?.screenY, // CORRECT
|
|
13
|
+
screenYBottom : globalThis?.screen.availHeight - globalThis?.screenY - globalThis?.outerHeight, // TO TEST
|
|
14
|
+
screenCenterX : globalThis?.screen.availWidth/2, // CORRECT
|
|
15
|
+
screenCenterY : globalThis?.screen.availHeight/2,// CORRECT
|
|
16
|
+
windowCenterX : globalThis?.outerWidth/2+globalThis?.screenX, // CORRECT
|
|
17
|
+
windowCenterY : globalThis?.outerHeight/2+ globalThis?.screenY, // FALSE
|
|
18
|
+
deltaCenterX : globalThis?.screen.availWidth/2-globalThis?.outerWidth/2+globalThis?.screenX, // CORRECT
|
|
19
|
+
deltaCenterY : null //
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
get x0(){
|
|
23
|
+
return map(globalThis?.screenX, 0, globalThis.screen.availWidth, -1, 1);
|
|
24
|
+
}
|
|
25
|
+
get y0(){
|
|
26
|
+
return - map(globalThis?.screenY, 0, globalThis.screen.availHeight, -1, 1);
|
|
27
|
+
}
|
|
28
|
+
get x1(){
|
|
29
|
+
return map(globalThis?.screenX + globalThis?.outerWidth, 0, globalThis.screen.availWidth, -1, 1);
|
|
30
|
+
}
|
|
31
|
+
get y1(){
|
|
32
|
+
return - map(globalThis?.screenY + globalThis?.outerHeight, 0, globalThis.screen.availHeight, -1, 1);
|
|
33
|
+
}
|
|
34
|
+
get cx(){
|
|
35
|
+
return map(globalThis?.outerWidth/2+globalThis?.screenX, 0, globalThis.screen.availWidth, -1, 1);
|
|
36
|
+
}
|
|
37
|
+
get cy(){
|
|
38
|
+
return - map(globalThis?.outerHeight/2+ globalThis?.screenY, 0, globalThis.screen.availHeight, -1, 1);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const watchScreen=(callback)=>new ZikoScreenObserver(callback);
|
|
43
|
+
export{
|
|
44
|
+
watchScreen
|
|
45
|
+
}
|