ziko 0.0.11 → 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/README.md +6 -3
- package/dist/ziko.cjs +5640 -4532
- package/dist/ziko.js +5640 -4532
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +5602 -4532
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ziko",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "a versatile JavaScript library offering a rich set of UI components, advanced mathematical utilities,Reactivity,animations,client side routing and graphics capabilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Zikojs",
|
|
@@ -19,8 +19,7 @@
|
|
|
19
19
|
"module": "dist/ziko.mjs",
|
|
20
20
|
"unpkg": "dist/ziko.min.js",
|
|
21
21
|
"files": [
|
|
22
|
-
"
|
|
23
|
-
"wrapper",
|
|
22
|
+
"src",
|
|
24
23
|
"dist",
|
|
25
24
|
"LICENCE"
|
|
26
25
|
],
|
|
@@ -29,22 +28,50 @@
|
|
|
29
28
|
"import": "./dist/ziko.mjs",
|
|
30
29
|
"require": "./dist/ziko.cjs"
|
|
31
30
|
},
|
|
32
|
-
"./
|
|
33
|
-
"import": "./src/
|
|
31
|
+
"./math": {
|
|
32
|
+
"import": "./src/math/index.js"
|
|
34
33
|
},
|
|
35
|
-
"./
|
|
36
|
-
"import": "./
|
|
34
|
+
"./math/functions": {
|
|
35
|
+
"import": "./src/math/functions/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./math/matrix": {
|
|
38
|
+
"import": "./src/math/matrix/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./math/complex": {
|
|
41
|
+
"import": "./src/math/complex/index.js"
|
|
42
|
+
},
|
|
43
|
+
"./math/signal": {
|
|
44
|
+
"import": "./src/math/signal/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./ui": {
|
|
47
|
+
"import": "./src/ui/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./time": {
|
|
50
|
+
"import": "./src/time/index.js"
|
|
51
|
+
},
|
|
52
|
+
"./reactivity": {
|
|
53
|
+
"import": "./src/reactivity/index.js"
|
|
54
|
+
},
|
|
55
|
+
"./data": {
|
|
56
|
+
"import": "./src/data/index.js"
|
|
57
|
+
},
|
|
58
|
+
"./graphics": {
|
|
59
|
+
"import": "./src/data/graphics.js"
|
|
60
|
+
},
|
|
61
|
+
"./jsx-runtime": {
|
|
62
|
+
"import": "./src/runtime/jsx-runtime/index.js"
|
|
37
63
|
}
|
|
38
64
|
},
|
|
39
65
|
"bin": {
|
|
40
66
|
"create-ziko-app": "starter/bin/index.js"
|
|
41
67
|
},
|
|
42
68
|
"scripts": {
|
|
43
|
-
"test": "
|
|
69
|
+
"test": "npx jasmine --config=jasmine.json",
|
|
44
70
|
"test-link": "node _link/index.js",
|
|
45
71
|
"lint": "eslint src/*/*/*",
|
|
46
|
-
"dev": "rollup
|
|
47
|
-
"
|
|
72
|
+
"dev": "cross-env NODE_ENV=development rollup --config rollup.config.js",
|
|
73
|
+
"watch": "cross-env NODE_ENV=development rollup --config rollup.config.js -w",
|
|
74
|
+
"build": "cross-env NODE_ENV=production rollup --config rollup.config.js"
|
|
48
75
|
},
|
|
49
76
|
"repository": {
|
|
50
77
|
"type": "git",
|
|
@@ -57,12 +84,12 @@
|
|
|
57
84
|
},
|
|
58
85
|
"homepage": "https://github.com/zakarialaoui10/ziko.js#readme",
|
|
59
86
|
"devDependencies": {
|
|
60
|
-
"@rollup/plugin-babel": "^6.0.4",
|
|
61
87
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
62
88
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
63
89
|
"@rollup/plugin-terser": "^0.4.4",
|
|
64
|
-
"
|
|
90
|
+
"cross-env": "^7.0.3",
|
|
65
91
|
"eslint": "^8.52.0",
|
|
92
|
+
"jasmine": "^5.3.0",
|
|
66
93
|
"rollup": "^4.1.5",
|
|
67
94
|
"rollup-plugin-livereload": "^2.0.5",
|
|
68
95
|
"rollup-plugin-serve": "^1.1.1"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const mixin = (target, ...sources) => {
|
|
2
|
+
sources.forEach(source => {
|
|
3
|
+
Object.getOwnPropertyNames(source.prototype).forEach(name => {
|
|
4
|
+
if (name !== 'constructor') {
|
|
5
|
+
target[name] = source.prototype[name];
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
class A {
|
|
12
|
+
constructor(){
|
|
13
|
+
this.msg="from A";
|
|
14
|
+
}
|
|
15
|
+
a() {
|
|
16
|
+
console.log(this.msg);
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
class B{
|
|
22
|
+
constructor(){
|
|
23
|
+
this.msg="from B";
|
|
24
|
+
}
|
|
25
|
+
b() {
|
|
26
|
+
console.log(this.msg);
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
class AB {
|
|
32
|
+
constructor() {
|
|
33
|
+
this.msg="from AB"
|
|
34
|
+
mixin(this.__proto__, A, B);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
ab=new AB()
|
|
39
|
+
export{
|
|
40
|
+
mixin
|
|
41
|
+
}
|
|
File without changes
|
package/src/app/app.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ZikoUIFlex } from "../user-interface/elements/derived/Flex.js";
|
|
2
|
+
import { Seo } from "./seo/index.js";
|
|
3
|
+
import { useHashEvent } from "../reactivity/index.js";
|
|
4
|
+
class ZikoUIApp extends ZikoUIFlex{
|
|
5
|
+
constructor(){
|
|
6
|
+
super("main");
|
|
7
|
+
this.root=document.documentElement;
|
|
8
|
+
this.head=null;
|
|
9
|
+
this.#init();
|
|
10
|
+
this.seo=Seo(this);
|
|
11
|
+
Object.assign(this.events,{
|
|
12
|
+
hash:null
|
|
13
|
+
})
|
|
14
|
+
Object.assign(this.cache,{
|
|
15
|
+
theme:null,
|
|
16
|
+
isRoot:true
|
|
17
|
+
});
|
|
18
|
+
// globalThis.__Ziko__.__Config__.default.render && this.render();
|
|
19
|
+
}
|
|
20
|
+
#init(){
|
|
21
|
+
this.root.setAttribute("data-engine","zikojs");
|
|
22
|
+
const head=this.root.getElementsByTagName("head")[0];
|
|
23
|
+
this.head=head?head:this.head=document?.createElementtt("head");
|
|
24
|
+
if(!head)this.root.insertBefore(this.head,document?.body);
|
|
25
|
+
const title=this.head.getElementsByTagName("title")[0];
|
|
26
|
+
this.Title=title?title:document?.createElementt("title");
|
|
27
|
+
if(!title)this.head.append(this.Title);
|
|
28
|
+
}
|
|
29
|
+
title(title=this.title.textContent){
|
|
30
|
+
this.Title.textContent=title;
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
prefetch(){
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
description(){
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
onHashChange(...callbacks){
|
|
40
|
+
if(!this.events.hash)this.events.hash = useHashEvent(this);
|
|
41
|
+
this.events.hash.onChange(...callbacks);
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const App=(...UIElement)=>new ZikoUIApp().append(...UIElement)
|
|
46
|
+
export {App};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// if(globalThis?.document){
|
|
2
|
+
// class ZikoUIComponent extends HTMLElement{
|
|
3
|
+
// constructor(){
|
|
4
|
+
// super();
|
|
5
|
+
// this.shadowDOM = this.attachShadow({ mode: 'open' });
|
|
6
|
+
// this.wrapper=document?.createElementt("div");
|
|
7
|
+
// }
|
|
8
|
+
// connectedCallback() {
|
|
9
|
+
// this.setAttribute('role', 'region');
|
|
10
|
+
// this.setAttribute('data-engine',"zikojs");
|
|
11
|
+
// this.shadowDOM.append(this.wrapper);
|
|
12
|
+
// this.observeContentChanges();
|
|
13
|
+
// }
|
|
14
|
+
// observeContentChanges() {
|
|
15
|
+
// const observer = new MutationObserver((mutations) => {
|
|
16
|
+
// mutations.forEach((mutation) => {
|
|
17
|
+
// if (mutation.type === 'childList' || mutation.type === 'characterData') {
|
|
18
|
+
// this.wrapper.innerHTML="";
|
|
19
|
+
// __Ziko__.__Config__.setDefault({ target: this.wrapper });
|
|
20
|
+
// globalThis.eval(this.innerHTML);
|
|
21
|
+
// }
|
|
22
|
+
// });
|
|
23
|
+
// });
|
|
24
|
+
// observer.observe(this, { childList: true, subtree: true, characterData: true });
|
|
25
|
+
// }
|
|
26
|
+
|
|
27
|
+
// disconnectedCallback() {
|
|
28
|
+
// console.log('ZikoUIComponent removed from page.');
|
|
29
|
+
// }
|
|
30
|
+
// }
|
|
31
|
+
// globalThis.customElements.define('ziko-ui', ZikoUIComponent);
|
|
32
|
+
// }
|
|
33
|
+
// else {
|
|
34
|
+
// var ZikoUIComponent = null;
|
|
35
|
+
// }
|
|
36
|
+
// export{
|
|
37
|
+
// ZikoUIComponent
|
|
38
|
+
// }
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const __UI__={}
|
|
2
|
+
const __Config__={
|
|
3
|
+
default:{
|
|
4
|
+
target:null,
|
|
5
|
+
render:true,
|
|
6
|
+
math:{
|
|
7
|
+
mode:"deg"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
setDefault:function(pairs){
|
|
11
|
+
const keys=Object.keys(pairs);
|
|
12
|
+
const values=Object.values(pairs);
|
|
13
|
+
for(let i=0;i<keys.length;i++)this.default[keys[i]]=values[i];
|
|
14
|
+
},
|
|
15
|
+
init:()=>document.documentElement.setAttribute("data-engine","zikojs")
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
__UI__,
|
|
19
|
+
__Config__
|
|
20
|
+
}
|
package/src/app/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
function parseParams(queryString) {
|
|
2
|
+
const params = {};
|
|
3
|
+
queryString.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi, (match) => {
|
|
4
|
+
const [key, value] = match.split('=');
|
|
5
|
+
params[key] = value;
|
|
6
|
+
});
|
|
7
|
+
return params;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function defineParamsGetter(target = globalThis){
|
|
11
|
+
Object.defineProperties(target, {
|
|
12
|
+
'QueryParams': {
|
|
13
|
+
get: function() {
|
|
14
|
+
return parseParams(location.search.substring(1));
|
|
15
|
+
},
|
|
16
|
+
configurable: false,
|
|
17
|
+
enumerable: true
|
|
18
|
+
},
|
|
19
|
+
'HashParams': {
|
|
20
|
+
get: function() {
|
|
21
|
+
const hash = window.location.hash.substring(1);
|
|
22
|
+
return parseParams(hash);
|
|
23
|
+
},
|
|
24
|
+
configurable: false,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
/*
|
|
32
|
+
|
|
33
|
+
/users?name=ziko&age=26
|
|
34
|
+
/users#name=ziko
|
|
35
|
+
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
export{
|
|
39
|
+
defineParamsGetter
|
|
40
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { text } from "../../user-interface/elements/primitives/text/index.js";
|
|
2
|
+
class ZikoSPA{
|
|
3
|
+
constructor(root_UI,routes){
|
|
4
|
+
this.root_UI=root_UI;
|
|
5
|
+
this.routes=new Map([
|
|
6
|
+
[404,text("Error 404")],
|
|
7
|
+
...Object.entries(routes)
|
|
8
|
+
]);
|
|
9
|
+
this.patterns=new Map();
|
|
10
|
+
this.maintain();
|
|
11
|
+
window.onpopstate = this.render(location.pathname);
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
// get(path,wrapper){
|
|
15
|
+
// (path instanceof RegExp)
|
|
16
|
+
// ? this.patterns.set(path,wrapper)
|
|
17
|
+
// : this.routes.set(path,wrapper);
|
|
18
|
+
// this.maintain();
|
|
19
|
+
// return this;
|
|
20
|
+
// }
|
|
21
|
+
get(path, wrapper) {
|
|
22
|
+
if (typeof path === 'string' && path.includes(':')) {
|
|
23
|
+
const params = [];
|
|
24
|
+
const regex = new RegExp(`^${path.replace(/:([^/]+)/g, (match, paramName) => {
|
|
25
|
+
params.push(paramName);
|
|
26
|
+
return '(.+)';
|
|
27
|
+
})}$`);
|
|
28
|
+
this.patterns.set(regex, (path) => {
|
|
29
|
+
const values = regex.exec(path).slice(1);
|
|
30
|
+
wrapper(...values);
|
|
31
|
+
});
|
|
32
|
+
} else {
|
|
33
|
+
(path instanceof RegExp)
|
|
34
|
+
? this.patterns.set(path, wrapper)
|
|
35
|
+
: this.routes.set(path, wrapper);
|
|
36
|
+
}
|
|
37
|
+
this.maintain();
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
maintain(){
|
|
41
|
+
this.root_UI.append(...this.routes.values());
|
|
42
|
+
[...this.routes.values()].map(n=>n.render(false));
|
|
43
|
+
this.render(location.pathname)
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
render(path){
|
|
47
|
+
if(this.routes.get(path))this.routes.get(path).render(true);
|
|
48
|
+
else{
|
|
49
|
+
const key=[...this.patterns.keys()].find(pattern=>pattern.test(path))
|
|
50
|
+
if(key)this.patterns.get(key)(path);
|
|
51
|
+
else this.routes.get(404).render(true)
|
|
52
|
+
}
|
|
53
|
+
window.history.pushState({}, "", path);
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const SPA=(root_UI,routes,patterns)=>new ZikoSPA(root_UI,routes,patterns);
|
|
58
|
+
|
|
59
|
+
export {SPA}
|
|
60
|
+
|
|
61
|
+
/*
|
|
62
|
+
// Static
|
|
63
|
+
S.get("/url",wrapper)
|
|
64
|
+
// Dynamique
|
|
65
|
+
s.get("/url/name/:name/id/:id",(path,name,id)=>handler())
|
|
66
|
+
// regEx
|
|
67
|
+
*/
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
class ZikoSeo{
|
|
2
|
+
constructor(app){
|
|
3
|
+
this.app=app;
|
|
4
|
+
this.meta={};
|
|
5
|
+
this.#setMeta("generator","zikojs")
|
|
6
|
+
}
|
|
7
|
+
#setMeta(key,value){
|
|
8
|
+
const meta=document.querySelector(`meta[name=${key}]`);
|
|
9
|
+
this.meta=meta?meta:document?.createElement("meta");
|
|
10
|
+
this.meta.setAttribute("name",key);
|
|
11
|
+
this.meta.setAttribute("content",value);
|
|
12
|
+
if(!meta)this.app.head.append(this.meta);
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
charset(charset="utf-8"){
|
|
16
|
+
const meta=document.querySelector("meta[charset]");
|
|
17
|
+
this.meta=meta?meta:document?.createElementt("meta");
|
|
18
|
+
this.meta.setAttribute("charset",charset);
|
|
19
|
+
if(!meta)this.app.head.append(this.meta);
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
description(description){
|
|
23
|
+
this.#setMeta("description",description);
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
viewport(viewport="width=device-width, initial-scale=1.0"){
|
|
27
|
+
this.#setMeta("viewport",viewport);
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
keywords(...keywords){
|
|
31
|
+
keywords.push("zikojs");
|
|
32
|
+
keywords=[...new Set(keywords)].join(", ");
|
|
33
|
+
this.#setMeta("keywords",keywords);
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
author(name="",email=""){
|
|
37
|
+
const author=[name,email].join(", ");
|
|
38
|
+
this.#setMeta("author",author);
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const Seo=(app)=>new ZikoSeo(app);
|
|
43
|
+
export{Seo}
|