encommon 0.21.0__py3-none-any.whl → 0.22.1__py3-none-any.whl

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.
Files changed (54) hide show
  1. encommon/times/common.py +3 -0
  2. encommon/times/unitime.py +23 -11
  3. encommon/version.txt +1 -1
  4. encommon/webkit/__init__.py +15 -0
  5. encommon/webkit/content.py +94 -0
  6. encommon/webkit/images/enasis.svg +174 -0
  7. encommon/webkit/images/failure.svg +15 -0
  8. encommon/webkit/images/information.svg +18 -0
  9. encommon/webkit/images/success.svg +18 -0
  10. encommon/webkit/images/warning.svg +16 -0
  11. encommon/webkit/index.html +218 -0
  12. encommon/webkit/scripts/color.js +60 -0
  13. encommon/webkit/scripts/datagrid.js +105 -0
  14. encommon/webkit/scripts/datetime.js +160 -0
  15. encommon/webkit/scripts/default.js +327 -0
  16. encommon/webkit/scripts/duration.js +150 -0
  17. encommon/webkit/scripts/helpers.js +247 -0
  18. encommon/webkit/scripts/image.js +39 -0
  19. encommon/webkit/scripts/message.js +31 -0
  20. encommon/webkit/scripts/moderate.js +71 -0
  21. encommon/webkit/scripts/numeric.js +189 -0
  22. encommon/webkit/scripts/statate.js +35 -0
  23. encommon/webkit/scripts/tagues.js +34 -0
  24. encommon/webkit/styles/color.css +57 -0
  25. encommon/webkit/styles/datagrid.css +58 -0
  26. encommon/webkit/styles/datetime.css +50 -0
  27. encommon/webkit/styles/default.css +204 -0
  28. encommon/webkit/styles/duration.css +44 -0
  29. encommon/webkit/styles/image.css +60 -0
  30. encommon/webkit/styles/message.css +88 -0
  31. encommon/webkit/styles/moderate.css +64 -0
  32. encommon/webkit/styles/numeric.css +55 -0
  33. encommon/webkit/styles/statate.css +50 -0
  34. encommon/webkit/styles/tagues.css +45 -0
  35. encommon/webkit/test/__init__.py +39 -0
  36. encommon/webkit/test/conftest.py +52 -0
  37. encommon/webkit/test/test_color.py +64 -0
  38. encommon/webkit/test/test_content.py +98 -0
  39. encommon/webkit/test/test_datagrid.py +90 -0
  40. encommon/webkit/test/test_datetime.py +75 -0
  41. encommon/webkit/test/test_default.py +314 -0
  42. encommon/webkit/test/test_duration.py +74 -0
  43. encommon/webkit/test/test_helpers.py +382 -0
  44. encommon/webkit/test/test_image.py +62 -0
  45. encommon/webkit/test/test_message.py +64 -0
  46. encommon/webkit/test/test_moderate.py +75 -0
  47. encommon/webkit/test/test_numeric.py +164 -0
  48. encommon/webkit/test/test_statate.py +78 -0
  49. encommon/webkit/test/test_tagues.py +66 -0
  50. {encommon-0.21.0.dist-info → encommon-0.22.1.dist-info}/METADATA +1 -1
  51. {encommon-0.21.0.dist-info → encommon-0.22.1.dist-info}/RECORD +54 -8
  52. {encommon-0.21.0.dist-info → encommon-0.22.1.dist-info}/LICENSE +0 -0
  53. {encommon-0.21.0.dist-info → encommon-0.22.1.dist-info}/WHEEL +0 -0
  54. {encommon-0.21.0.dist-info → encommon-0.22.1.dist-info}/top_level.txt +0 -0
encommon/times/common.py CHANGED
@@ -23,6 +23,9 @@ NUMERISH = compile(
23
23
  SNAPABLE = compile(
24
24
  r'^(\-|\+)[\d\@a-z\-\+]+$')
25
25
 
26
+ UNITIME = Union[
27
+ int | float | str]
28
+
26
29
  STRINGNOW = {
27
30
  'None', None,
28
31
  'null', 'now'}
encommon/times/unitime.py CHANGED
@@ -7,14 +7,27 @@ is permitted, for more information consult the project license file.
7
7
 
8
8
 
9
9
 
10
+ from re import compile
10
11
  from re import match as re_match
11
12
 
13
+ from .common import UNITIME
12
14
  from .parse import since_time
13
15
 
14
16
 
15
17
 
18
+ NOTATE = compile(
19
+ r'^(\d+(s|m|h|d|w|y))*$')
20
+
21
+ STRINT = compile(
22
+ r'^\d+$')
23
+
24
+ STRFLT = compile(
25
+ r'^\d+\.\d+$')
26
+
27
+
28
+
16
29
  def unitime(
17
- input: int | float | str,
30
+ input: UNITIME,
18
31
  ) -> int:
19
32
  """
20
33
  Return the seconds in integer format for provided input.
@@ -32,23 +45,22 @@ def unitime(
32
45
  :returns: Seconds in integer format for provided input.
33
46
  """
34
47
 
35
- notate = r'^(\d+(s|m|h|d|w|y))*$'
36
- strint = r'^\d+$'
37
- strflt = r'^\d+\.\d+$'
38
-
39
48
  if isinstance(input, str):
40
49
 
41
- if re_match(notate, input):
42
- input = since_time(
43
- 'now', f'+{input}')
44
-
45
- elif re_match(strint, input):
50
+ if re_match(STRINT, input):
46
51
  input = int(input)
47
52
 
48
- elif re_match(strflt, input):
53
+ elif re_match(STRFLT, input):
49
54
  input = int(
50
55
  input.split('.')[0])
51
56
 
57
+ elif re_match(NOTATE, input):
58
+ input = since_time(
59
+ 'now', f'+{input}')
60
+
61
+ else: # NOCVR
62
+ raise ValueError('input')
63
+
52
64
  if isinstance(input, float):
53
65
  input = int(input)
54
66
 
encommon/version.txt CHANGED
@@ -1 +1 @@
1
- 0.21.0
1
+ 0.22.1
@@ -0,0 +1,15 @@
1
+ """
2
+ Functions and routines associated with Enasis Network Common Library.
3
+
4
+ This file is part of Enasis Network software eco-system. Distribution
5
+ is permitted, for more information consult the project license file.
6
+ """
7
+
8
+
9
+
10
+ from .content import Content
11
+
12
+
13
+
14
+ __all__ = [
15
+ 'Content']
@@ -0,0 +1,94 @@
1
+ """
2
+ Functions and routines associated with Enasis Network Common Library.
3
+
4
+ This file is part of Enasis Network software eco-system. Distribution
5
+ is permitted, for more information consult the project license file.
6
+ """
7
+
8
+
9
+
10
+ from pathlib import Path
11
+ from typing import Optional
12
+
13
+ from ..utils import read_text
14
+
15
+
16
+
17
+ IMAGES = (
18
+ Path(__file__).parent
19
+ / 'images')
20
+
21
+ SCRIPTS = (
22
+ Path(__file__).parent
23
+ / 'scripts')
24
+
25
+ STYLES = (
26
+ Path(__file__).parent
27
+ / 'styles')
28
+
29
+
30
+
31
+ class Content:
32
+ """
33
+ Access common content used with application interfaces.
34
+ """
35
+
36
+
37
+ @classmethod
38
+ def images(
39
+ cls,
40
+ name: str,
41
+ ) -> Optional[str]:
42
+ """
43
+ Return the contents requested stored within the project.
44
+
45
+ :param name: Which file in the project will be returned.
46
+ :returns: Contents requested stored within the project.
47
+ """
48
+
49
+ path = IMAGES / f'{name}.svg'
50
+
51
+ if not path.exists():
52
+ return None
53
+
54
+ return read_text(path)
55
+
56
+
57
+ @classmethod
58
+ def scripts(
59
+ cls,
60
+ name: str,
61
+ ) -> Optional[str]:
62
+ """
63
+ Return the contents requested stored within the project.
64
+
65
+ :param name: Which file in the project will be returned.
66
+ :returns: Contents requested stored within the project.
67
+ """
68
+
69
+ path = SCRIPTS / f'{name}.js'
70
+
71
+ if not path.exists():
72
+ return None
73
+
74
+ return read_text(path)
75
+
76
+
77
+ @classmethod
78
+ def styles(
79
+ cls,
80
+ name: str,
81
+ ) -> Optional[str]:
82
+ """
83
+ Return the contents requested stored within the project.
84
+
85
+ :param name: Which file in the project will be returned.
86
+ :returns: Contents requested stored within the project.
87
+ """
88
+
89
+ path = STYLES / f'{name}.css'
90
+
91
+ if not path.exists():
92
+ return None
93
+
94
+ return read_text(path)
@@ -0,0 +1,174 @@
1
+ <svg
2
+ xmlns="http://www.w3.org/2000/svg"
3
+ height="442px"
4
+ viewBox="0 0 442 442"
5
+ width="442px">
6
+ <path
7
+ fill="none"
8
+ opacity="1.000000"
9
+ stroke="none"
10
+ d="M443.000000,362.000000C443.000000,388.980438 443.000000,415.960846
11
+ 443.000000,442.940491C295.666656,442.939697 148.333313,442.939697
12
+ 1.000000,442.939697C1.000000,416.232025 1.000000,389.584686 1.246922,
13
+ 362.450500C1.493844,361.963654 1.971579,361.833344 2.438007,
14
+ 361.898834C76.779030,361.974976 150.653625,361.986176 224.528229,
15
+ 361.989563C225.356949,361.989594 226.185684,361.887695 227.258835,
16
+ 361.846863C227.858200,361.679779 227.968231,361.402130 227.898834,
17
+ 360.561066C227.920670,337.391663 227.877014,314.688629 227.846848,
18
+ 291.741150C227.679779,291.141785 227.402145,291.031769 226.561096,
19
+ 291.101166C181.894318,291.035675 137.693909,291.035675 93.356239,
20
+ 291.035675C93.356239,278.401245 93.356239,266.375610 93.356239,
21
+ 253.833344C114.811584,253.833344 135.912979,253.833344 157.258820,
22
+ 253.846848C157.858231,253.679764 157.968246,253.402115 157.898834,
23
+ 252.561066C157.920670,230.391678 157.877014,208.688644 157.846863,
24
+ 186.741180C157.679764,186.141769 157.402115,186.031754 156.561066,
25
+ 186.101166C135.197708,186.035690 114.300705,186.035690 93.401344,
26
+ 186.035690C93.401344,174.644379 93.401344,163.949188 93.401344,
27
+ 153.000000C99.278572,153.000000 104.756264,153.006500 110.233948,
28
+ 152.998962C149.160767,152.945358 188.087570,152.888901 227.258820,
29
+ 152.846848C227.858231,152.679764 227.968246,152.402115 227.898834,
30
+ 151.561066C227.920654,128.391678 227.876999,105.688644 227.846848,
31
+ 82.741180C227.679779,82.141800 227.402145,82.031769 226.561081,
32
+ 82.101173C152.220505,82.025017 78.346275,82.013817 4.472044,
33
+ 82.010468C3.643328,82.010429 2.814607,82.112343 1.743549,
34
+ 82.100548C1.334140,82.022949 1.167070,82.011475 1.000000,
35
+ 82.000000C1.000000,55.019562 1.000000,28.039125 1.000004,
36
+ 1.059518C148.333344,1.060348 295.666687,1.060348 443.000000,
37
+ 1.060348C443.000000,27.768024 443.000000,54.415356 442.531342,
38
+ 81.531342C412.142517,82.000000 382.222321,82.000000 351.415222,
39
+ 82.000000C351.415222,123.653839 351.415222,164.554214 351.415222,
40
+ 205.454575C350.966827,205.579773 350.518433,205.704956 350.070038,
41
+ 205.830139C343.114441,197.728653 336.079834,189.693375 329.222595,
42
+ 181.509491C319.928558,170.417343 310.816833,159.172531 301.539551,
43
+ 148.066193C293.828949,138.835388 285.949310,129.745880 278.222260,
44
+ 120.528641C268.605591,109.057358 258.889954,97.660851 249.595901,
45
+ 85.931870C246.401871,81.901085 242.961899,81.272049 237.925476,
46
+ 82.576553C237.925476,109.195648 237.925476,135.915100 237.925476,
47
+ 163.074326C214.387756,163.074326 191.461670,163.074326 168.355743,
48
+ 163.074326C168.355743,202.565430 168.355743,241.605698 168.355743,
49
+ 281.095032C191.633194,281.095032 214.559387,281.095032 238.105438,
50
+ 281.095032C238.105438,308.250610 238.105438,334.963623 238.105438,
51
+ 361.716949C245.658249,361.716949 252.580795,361.716949 260.067413,
52
+ 361.716949C260.067413,320.406921 260.067413,279.375366 260.067413,
53
+ 237.015121C262.169159,238.927551 263.465485,239.863388 264.460052,
54
+ 241.051788C270.793762,248.619995 277.025909,256.273224 283.359283,
55
+ 263.841766C290.758545,272.684021 298.269073,281.433197 305.654938,
56
+ 290.286530C315.137909,301.653595 324.545349,313.083771 333.984467,
57
+ 324.487427C341.744415,333.862488 349.657501,343.116394 357.207214,
58
+ 352.657837C362.100006,358.841400 367.019470,362.673401 376.012756,
59
+ 362.302307C398.308044,361.382202 420.666748,362.000000 443.000000,
60
+ 362.000000z"/>
61
+ <path
62
+ fill="#009999"
63
+ opacity="1.000000"
64
+ stroke="none"
65
+ d="M443.000000,361.531342C420.666748,362.000000 398.308044,361.382202
66
+ 376.012756,362.302307C367.019470,362.673401 362.100006,358.841400
67
+ 357.207214,352.657837C349.657501,343.116394 341.744415,333.862488
68
+ 333.984467,324.487427C324.545349,313.083771 315.137909,301.653595
69
+ 305.654938,290.286530C298.269073,281.433197 290.758545,272.684021
70
+ 283.359283,263.841766C277.025909,256.273224 270.793762,248.619995
71
+ 264.460052,241.051788C263.465485,239.863388 262.169159,238.927551
72
+ 260.067413,237.015121C260.067413,279.375366 260.067413,320.406921
73
+ 260.067413,361.716949C252.580795,361.716949 245.658249,361.716949
74
+ 238.105438,361.716949C238.105438,334.963623 238.105438,308.250610
75
+ 238.105438,281.095032C214.559387,281.095032 191.633194,281.095032
76
+ 168.355743,281.095032C168.355743,241.605698 168.355743,202.565430
77
+ 168.355743,163.074326C191.461670,163.074326 214.387756,163.074326
78
+ 237.925476,163.074326C237.925476,135.915100 237.925476,109.195648
79
+ 237.925476,82.576553C242.961899,81.272049 246.401871,81.901085
80
+ 249.595901,85.931870C258.889954,97.660851 268.605591,109.057358
81
+ 278.222260,120.528641C285.949310,129.745880 293.828949,138.835388
82
+ 301.539551,148.066193C310.816833,159.172531 319.928558,170.417343
83
+ 329.222595,181.509491C336.079834,189.693375 343.114441,197.728653
84
+ 350.070038,205.830139C350.518433,205.704956 350.966827,205.579773
85
+ 351.415222,205.454575C351.415222,164.554214 351.415222,123.653839
86
+ 351.415222,82.000000C382.222321,82.000000 412.142517,82.000000
87
+ 442.531342,82.000000C443.000000,175.020889 443.000000,268.041779
88
+ 443.000000,361.531342z"/>
89
+ <path
90
+ fill="#009999"
91
+ opacity="1.000000"
92
+ stroke="none"
93
+ d="M157.014389,253.833344C135.912979,253.833344 114.811584,253.833344
94
+ 93.356239,253.833344C93.356239,266.375610 93.356239,278.401245
95
+ 93.356239,291.035675C137.693909,291.035675 181.894318,291.035675
96
+ 226.688522,291.244324C227.457138,291.639679 227.640823,291.817230
97
+ 227.833344,291.985596C227.877014,314.688629 227.920670,337.391663
98
+ 227.755676,360.688477C227.360291,361.457092 227.182755,361.640778
99
+ 227.014404,361.833344C226.185684,361.887695 225.356949,361.989594
100
+ 224.528229,361.989563C150.653625,361.986176 76.779030,361.974976
101
+ 2.281695,361.753479C1.446564,361.352936 1.226912,361.172058 1.000000,
102
+ 361.000000C1.000000,268.645782 1.000000,176.291550 1.169742,
103
+ 83.336273C1.562412,82.554184 1.777880,82.364670 1.985888,
104
+ 82.166664C2.814607,82.112343 3.643328,82.010429 4.472044,
105
+ 82.010468C78.346275,82.013817 152.220505,82.025017 226.688522,
106
+ 82.244339C227.457108,82.639717 227.640778,82.817253 227.833344,
107
+ 82.985611C227.876999,105.688644 227.920654,128.391678 227.755676,
108
+ 151.688507C227.360291,152.457108 227.182755,152.640793 227.014389,
109
+ 152.833344C188.087570,152.888901 149.160767,152.945358 110.233948,
110
+ 152.998962C104.756264,153.006500 99.278572,153.000000 93.401344,
111
+ 153.000000C93.401344,163.949188 93.401344,174.644379 93.401344,
112
+ 186.035690C114.300705,186.035690 135.197708,186.035690 156.688507,
113
+ 186.244324C157.457108,186.639709 157.640793,186.817245 157.833344,
114
+ 186.985611C157.877014,208.688644 157.920670,230.391678 157.755676,
115
+ 252.688507C157.360291,253.457108 157.182755,253.640793 157.014389,
116
+ 253.833344z"/>
117
+ <path
118
+ fill="#009999"
119
+ opacity="1.000000"
120
+ stroke="none"
121
+ d="M1.743549,82.100548C1.777880,82.364670 1.562412,82.554184 1.169742,
122
+ 82.867615C1.000000,83.000000 1.000000,82.500000 1.000000,
123
+ 82.250000C1.167070,82.011475 1.334140,82.022949 1.743549,82.100548z"/>
124
+ <path
125
+ fill="#009999"
126
+ opacity="1.000000"
127
+ stroke="none"
128
+ d="M1.000000,361.250000C1.226912,361.172058 1.446564,361.352936 1.815267,
129
+ 361.687988C1.971579,361.833344 1.493844,361.963654 1.246922,
130
+ 361.981812C1.000000,362.000000 1.000000,361.500000 1.000000,
131
+ 361.250000z"/>
132
+ <path
133
+ fill="#009999"
134
+ opacity="1.000000"
135
+ stroke="none"
136
+ d="M227.846848,82.741180C227.640778,82.817253 227.457108,82.639717
137
+ 227.154877,82.309830C227.402145,82.031769 227.679779,82.141800
138
+ 227.846848,82.741180z"/>
139
+ <path
140
+ fill="#009999"
141
+ opacity="1.000000"
142
+ stroke="none"
143
+ d="M227.258820,152.846848C227.182755,152.640793 227.360291,
144
+ 152.457108 227.690186,152.154846C227.968246,152.402115 227.858231,
145
+ 152.679764 227.258820,152.846848z"/>
146
+ <path
147
+ fill="#009999"
148
+ opacity="1.000000"
149
+ stroke="none"
150
+ d="M157.846848,186.741180C157.640793,186.817245 157.457108,
151
+ 186.639709 157.154846,186.309814C157.402115,186.031754 157.679764,
152
+ 186.141769 157.846848,186.741180z"/>
153
+ <path
154
+ fill="#009999"
155
+ opacity="1.000000"
156
+ stroke="none"
157
+ d="M157.258820,253.846848 C157.182755,253.640793 157.360291,
158
+ 253.457108 157.690186,253.154846 C157.968246,253.402115 157.858231,
159
+ 253.679764 157.258820,253.846848z"/>
160
+ <path
161
+ fill="#009999"
162
+ opacity="1.000000"
163
+ stroke="none"
164
+ d="M227.846848,291.741150 C227.640823,291.817230 227.457138,
165
+ 291.639679 227.154877,291.309814 C227.402145,291.031769 227.679779,
166
+ 291.141785 227.846848,291.741150z"/>
167
+ <path
168
+ fill="#009999"
169
+ opacity="1.000000"
170
+ stroke="none"
171
+ d="M227.258835,361.846863C227.182755,361.640778 227.360291,
172
+ 361.457092 227.690186,361.154846C227.968231,361.402130 227.858200,
173
+ 361.679779 227.258835,361.846863z"/>
174
+ </svg>
@@ -0,0 +1,15 @@
1
+ <svg
2
+ xmlns="http://www.w3.org/2000/svg"
3
+ height="24px"
4
+ viewBox="0 0 24 24"
5
+ width="24px"
6
+ fill="#ff6666">
7
+ <path
8
+ d="M12 4c-4.42 0-8 3.58-8 8s3.58 8 8 8 8-3.58 8-8-3.58-8-8-8zm1
9
+ 13h-2v-2h2v2zm0-4h-2V7h2v6z"
10
+ opacity=".25"/>
11
+ <path
12
+ d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22
13
+ 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58
14
+ 8-8 8zm-1-5h2v2h-2zm0-8h2v6h-2z"/>
15
+ </svg>
@@ -0,0 +1,18 @@
1
+ <svg
2
+ xmlns="http://www.w3.org/2000/svg"
3
+ height="24px"
4
+ viewBox="0 0 24 24"
5
+ width="24px"
6
+ fill="#089bd8">
7
+ <path
8
+ d="M0 0h24v24H0V0z"
9
+ fill="none"/>
10
+ <path
11
+ d="M12 4c-4.41 0-8 3.59-8 8s3.59 8 8 8 8-3.59 8-8-3.59-8-8-8zm1
12
+ 13h-2v-6h2v6zm0-8h-2V7h2v2z"
13
+ opacity=".25"/>
14
+ <path
15
+ d="M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48
16
+ 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59
17
+ 8-8 8z"/>
18
+ </svg>
@@ -0,0 +1,18 @@
1
+ <svg
2
+ xmlns="http://www.w3.org/2000/svg"
3
+ height="24px"
4
+ viewBox="0 0 24 24"
5
+ width="24px"
6
+ fill="#66ff66">
7
+ <path
8
+ d="M0 0h24v24H0V0z"
9
+ fill="none"/>
10
+ <path
11
+ d="M12 4c-4.41 0-8 3.59-8 8s3.59 8 8 8 8-3.59 8-8-3.59-8-8-8zm-2 13-4-4
12
+ 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z"
13
+ opacity=".25"/>
14
+ <path
15
+ d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0
16
+ 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.59-12.42L10
17
+ 14.17l-2.59-2.58L6 13l4 4 8-8z"/>
18
+ </svg>
@@ -0,0 +1,16 @@
1
+ <svg
2
+ xmlns="http://www.w3.org/2000/svg"
3
+ height="24px"
4
+ viewBox="0 0 24 24"
5
+ width="24px"
6
+ fill="#ffff66">
7
+ <path
8
+ d="M0 0h24v24H0V0z"
9
+ fill="none"/>
10
+ <path
11
+ d="M12 5.99L4.47 19h15.06L12 5.99zM13 18h-2v-2h2v2zm-2-4v-4h2v4h-2z"
12
+ opacity=".25"/>
13
+ <path
14
+ d="M12 2L1 21h22L12 2zm0 3.99L19.53 19H4.47L12 5.99zM11
15
+ 16h2v2h-2zm0-6h2v4h-2z"/>
16
+ </svg>
@@ -0,0 +1,218 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Common Library</title>
5
+
6
+ <!-- meta data -->
7
+ <meta charset="utf-8">
8
+ <meta
9
+ name="viewport"
10
+ content="width=device-width, initial-scale=1.0">
11
+ <!-- meta data -->
12
+
13
+ <!-- link hrefs -->
14
+ <link rel="icon" href="images/enasis.svg">
15
+ <link rel="stylesheet" href="styles/default.css">
16
+ <link rel="stylesheet" href="styles/datagrid.css">
17
+ <link rel="stylesheet" href="styles/datetime.css">
18
+ <link rel="stylesheet" href="styles/duration.css">
19
+ <link rel="stylesheet" href="styles/image.css">
20
+ <link rel="stylesheet" href="styles/message.css">
21
+ <link rel="stylesheet" href="styles/moderate.css">
22
+ <link rel="stylesheet" href="styles/numeric.css">
23
+ <link rel="stylesheet" href="styles/statate.css">
24
+ <!-- link hrefs -->
25
+
26
+ <!-- scripts -->
27
+ <script src="scripts/default.js"></script>
28
+ <script src="scripts/helpers.js"></script>
29
+ <script src="scripts/datagrid.js"></script>
30
+ <script src="scripts/datetime.js"></script>
31
+ <script src="scripts/duration.js"></script>
32
+ <script src="scripts/image.js"></script>
33
+ <script src="scripts/message.js"></script>
34
+ <script src="scripts/moderate.js"></script>
35
+ <script src="scripts/numeric.js"></script>
36
+ <script src="scripts/statate.js"></script>
37
+ <!-- scripts -->
38
+
39
+ <!-- overrides -->
40
+ <style>
41
+
42
+ body {
43
+ padding: .75rem 1rem .75rem 1rem; }
44
+
45
+ .encommon_message {
46
+ margin: .1rem 0 .1rem 0; }
47
+
48
+ :root {
49
+ --svgicon-failure: url('../images/failure.svg');
50
+ --svgicon-information: url('../images/information.svg');
51
+ --svgicon-success: url('../images/success.svg');
52
+ --svgicon-warning: url('../images/warning.svg'); }
53
+
54
+ </style>
55
+ <!-- overrides -->
56
+
57
+ </head>
58
+ <body>
59
+
60
+
61
+ <!-- introduction -->
62
+ <h1>Enasis Network Vanilla Elements</h1>
63
+ <p>This page helps demonstrate the various elements available in
64
+ the <a href="https://github.com/enasisnetwork">Enasis Network</a>
65
+ vanilla JavaScript library. All CSS is based on REM unit.</p>
66
+ <p>It is a long-term goal that all the CSS also be responsive to
67
+ the latest and most common mobile devices.</p>
68
+ <!-- introduction -->
69
+
70
+
71
+ <!-- message function -->
72
+ <h2>Simple Toast Generator</h2>
73
+ <div id="message"></div>
74
+ <script>
75
+
76
+ let _MESSAGE =
77
+ 'Lorem ipsum dolor sit amet,'
78
+ + ' conseteur adipiscing.';
79
+
80
+ let _MESSAGES = [
81
+ 'success',
82
+ 'failure',
83
+ 'information',
84
+ 'warning'];
85
+
86
+ _MESSAGES.forEach(
87
+ (x) => {
88
+
89
+ let append = () => {
90
+
91
+ let element =
92
+ message(x, _MESSAGE);
93
+
94
+ $('#message')
95
+ .append(element);
96
+
97
+ $('#message')
98
+ .append($('<br/>')); }
99
+
100
+ whenready(append); });
101
+
102
+ </script>
103
+ <!-- message function -->
104
+
105
+
106
+ <!-- datagrid function -->
107
+ <h2>Simple Table Generator</h2>
108
+ <div id="datagrid"></div>
109
+ <script>
110
+
111
+
112
+ let _FIELDS = {
113
+ 'moderate': 'Moderate',
114
+ 'statate': 'Statate',
115
+ 'plain': 'Plaintext',
116
+ 'numeric': 'Numeric',
117
+ 'datestamp': 'Timestamp',
118
+ 'duration': 'Duration'};
119
+
120
+
121
+ let _VALUES = [
122
+
123
+ {'moderate':
124
+ moderate(
125
+ 'Value One',
126
+ 'information',
127
+ 'value_one'),
128
+ 'datestamp':
129
+ datestamp(
130
+ '2024-04-20T16:20:00Z'),
131
+ 'duration':
132
+ duration(
133
+ '2024-04-20T16:20:00Z'),
134
+ 'statate':
135
+ statate(
136
+ 'success',
137
+ 'Success',
138
+ 'All seems normal'),
139
+ 'numeric':
140
+ numeric_count(1e10 + 1e8),
141
+ 'plain': _MESSAGE},
142
+
143
+ {'moderate':
144
+ moderate(
145
+ 'Value Two',
146
+ 'information',
147
+ 'value_two'),
148
+ 'datestamp':
149
+ datestamp(
150
+ '2024-04-20T16:20:00Z'),
151
+ 'duration':
152
+ duration(
153
+ '2024-04-20T16:20:00Z'),
154
+ 'statate':
155
+ statate(
156
+ 'failure',
157
+ 'Failure',
158
+ 'Something is wrong'),
159
+ 'numeric':
160
+ numeric_bytes(1e10 + 1e8),
161
+ 'plain': _MESSAGE},
162
+
163
+ {'moderate':
164
+ moderate(
165
+ 'Value Three',
166
+ 'information',
167
+ 'value_three'),
168
+ 'datestamp':
169
+ datestamp(
170
+ '2024-04-20T16:20:00Z'),
171
+ 'duration':
172
+ duration(
173
+ '2024-04-20T16:20:00Z'),
174
+ 'statate':
175
+ statate(
176
+ 'information',
177
+ 'Waiting',
178
+ 'Waiting on status'),
179
+ 'numeric':
180
+ numeric_ftemp(69),
181
+ 'plain': _MESSAGE},
182
+
183
+ {'moderate':
184
+ moderate(
185
+ 'Value Four',
186
+ 'information',
187
+ 'value_four'),
188
+ 'datestamp':
189
+ datestamp(
190
+ '2024-04-20T16:20:00Z'),
191
+ 'duration':
192
+ duration(
193
+ '2024-04-20T16:20:00Z'),
194
+ 'statate':
195
+ statate(
196
+ 'warning',
197
+ 'Warning',
198
+ 'What is going on'),
199
+ 'numeric':
200
+ numeric_cftemp(69),
201
+ 'plain': _MESSAGE}];
202
+
203
+
204
+ whenready(function() {
205
+
206
+ let element =
207
+ datagrid(_FIELDS, _VALUES);
208
+
209
+ $('#datagrid')
210
+ .replace(element); });
211
+
212
+
213
+ </script>
214
+ <!-- datagrid function -->
215
+
216
+
217
+ </body>
218
+ </html>