cedro 0.1.9 → 0.1.11

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 (254) hide show
  1. package/README.md +7 -4
  2. package/dist/assets/_virtual/_commonjsHelpers.js +1 -0
  3. package/dist/assets/_virtual/index.js +1 -0
  4. package/dist/assets/_virtual/modulepreload-polyfill.js +1 -0
  5. package/dist/assets/_virtual/named-references.js +1 -0
  6. package/dist/assets/_virtual/numeric-unicode-map.js +1 -0
  7. package/dist/assets/_virtual/surrogate-pairs.js +1 -0
  8. package/dist/assets/core/application.builder.js +1 -0
  9. package/dist/assets/core/application.core.js +1 -0
  10. package/dist/assets/core/jsxsupport.js +1 -0
  11. package/dist/assets/core/screeen.core.js +1 -0
  12. package/dist/assets/core/seo.js +1 -0
  13. package/dist/assets/core/themes.core.js +1 -0
  14. package/dist/assets/core/uid.js +1 -0
  15. package/dist/assets/index.js +1 -0
  16. package/dist/assets/material-icons-outlined.woff +0 -0
  17. package/dist/assets/material-icons-outlined.woff2 +0 -0
  18. package/dist/assets/material-icons-round.woff +0 -0
  19. package/dist/assets/material-icons-round.woff2 +0 -0
  20. package/dist/assets/material-icons-sharp.woff +0 -0
  21. package/dist/assets/material-icons-sharp.woff2 +0 -0
  22. package/dist/assets/material-icons-two-tone.woff +0 -0
  23. package/dist/assets/material-icons-two-tone.woff2 +0 -0
  24. package/dist/assets/material-icons.woff +0 -0
  25. package/dist/assets/material-icons.woff2 +0 -0
  26. package/dist/assets/node_modules/@fontsource/roboto/100.css +1 -0
  27. package/dist/assets/node_modules/@fontsource/roboto/300.css +1 -0
  28. package/dist/assets/node_modules/@fontsource/roboto/400.css +1 -0
  29. package/dist/assets/node_modules/@fontsource/roboto/500.css +1 -0
  30. package/dist/assets/node_modules/@fontsource/roboto/700.css +1 -0
  31. package/dist/assets/node_modules/@fontsource/roboto/900.css +1 -0
  32. package/dist/assets/node_modules/html-entities/lib/index.js +1 -0
  33. package/dist/assets/node_modules/html-entities/lib/named-references.js +2 -0
  34. package/dist/assets/node_modules/html-entities/lib/numeric-unicode-map.js +1 -0
  35. package/dist/assets/node_modules/html-entities/lib/surrogate-pairs.js +1 -0
  36. package/dist/assets/node_modules/material-icons/iconfont/material-icons.css +1 -0
  37. package/dist/assets/node_modules/navigo/lib/es/Q.js +1 -0
  38. package/dist/assets/node_modules/navigo/lib/es/constants.js +1 -0
  39. package/dist/assets/node_modules/navigo/lib/es/index.js +1 -0
  40. package/dist/assets/node_modules/navigo/lib/es/lifecycles.js +1 -0
  41. package/dist/assets/node_modules/navigo/lib/es/middlewares/callHandler.js +1 -0
  42. package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForAfterHook.js +1 -0
  43. package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForAlreadyHook.js +1 -0
  44. package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForBeforeHook.js +1 -0
  45. package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForDeprecationMethods.js +1 -0
  46. package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForForceOp.js +1 -0
  47. package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForLeaveHook.js +1 -0
  48. package/dist/assets/node_modules/navigo/lib/es/middlewares/checkForNotFoundHandler.js +1 -0
  49. package/dist/assets/node_modules/navigo/lib/es/middlewares/errorOut.js +1 -0
  50. package/dist/assets/node_modules/navigo/lib/es/middlewares/flushCurrent.js +1 -0
  51. package/dist/assets/node_modules/navigo/lib/es/middlewares/matchPathToRegisteredRoutes.js +1 -0
  52. package/dist/assets/node_modules/navigo/lib/es/middlewares/processMatches.js +1 -0
  53. package/dist/assets/node_modules/navigo/lib/es/middlewares/setLocationPath.js +1 -0
  54. package/dist/assets/node_modules/navigo/lib/es/middlewares/updateBrowserURL.js +1 -0
  55. package/dist/assets/node_modules/navigo/lib/es/middlewares/updateState.js +1 -0
  56. package/dist/assets/node_modules/navigo/lib/es/middlewares/waitingList.js +1 -0
  57. package/dist/assets/node_modules/navigo/lib/es/utils.js +1 -0
  58. package/dist/assets/roboto-cyrillic-100-normal.woff +0 -0
  59. package/dist/assets/roboto-cyrillic-100-normal.woff2 +0 -0
  60. package/dist/assets/roboto-cyrillic-300-normal.woff +0 -0
  61. package/dist/assets/roboto-cyrillic-300-normal.woff2 +0 -0
  62. package/dist/assets/roboto-cyrillic-400-normal.woff +0 -0
  63. package/dist/assets/roboto-cyrillic-400-normal.woff2 +0 -0
  64. package/dist/assets/roboto-cyrillic-500-normal.woff +0 -0
  65. package/dist/assets/roboto-cyrillic-500-normal.woff2 +0 -0
  66. package/dist/assets/roboto-cyrillic-700-normal.woff +0 -0
  67. package/dist/assets/roboto-cyrillic-700-normal.woff2 +0 -0
  68. package/dist/assets/roboto-cyrillic-900-normal.woff +0 -0
  69. package/dist/assets/roboto-cyrillic-900-normal.woff2 +0 -0
  70. package/dist/assets/roboto-cyrillic-ext-100-normal.woff +0 -0
  71. package/dist/assets/roboto-cyrillic-ext-100-normal.woff2 +0 -0
  72. package/dist/assets/roboto-cyrillic-ext-300-normal.woff +0 -0
  73. package/dist/assets/roboto-cyrillic-ext-300-normal.woff2 +0 -0
  74. package/dist/assets/roboto-cyrillic-ext-400-normal.woff +0 -0
  75. package/dist/assets/roboto-cyrillic-ext-400-normal.woff2 +0 -0
  76. package/dist/assets/roboto-cyrillic-ext-500-normal.woff +0 -0
  77. package/dist/assets/roboto-cyrillic-ext-500-normal.woff2 +0 -0
  78. package/dist/assets/roboto-cyrillic-ext-700-normal.woff +0 -0
  79. package/dist/assets/roboto-cyrillic-ext-700-normal.woff2 +0 -0
  80. package/dist/assets/roboto-cyrillic-ext-900-normal.woff +0 -0
  81. package/dist/assets/roboto-cyrillic-ext-900-normal.woff2 +0 -0
  82. package/dist/assets/roboto-greek-100-normal.woff +0 -0
  83. package/dist/assets/roboto-greek-100-normal.woff2 +0 -0
  84. package/dist/assets/roboto-greek-300-normal.woff +0 -0
  85. package/dist/assets/roboto-greek-300-normal.woff2 +0 -0
  86. package/dist/assets/roboto-greek-400-normal.woff +0 -0
  87. package/dist/assets/roboto-greek-400-normal.woff2 +0 -0
  88. package/dist/assets/roboto-greek-500-normal.woff +0 -0
  89. package/dist/assets/roboto-greek-500-normal.woff2 +0 -0
  90. package/dist/assets/roboto-greek-700-normal.woff +0 -0
  91. package/dist/assets/roboto-greek-700-normal.woff2 +0 -0
  92. package/dist/assets/roboto-greek-900-normal.woff +0 -0
  93. package/dist/assets/roboto-greek-900-normal.woff2 +0 -0
  94. package/dist/assets/roboto-latin-100-normal.woff +0 -0
  95. package/dist/assets/roboto-latin-100-normal.woff2 +0 -0
  96. package/dist/assets/roboto-latin-300-normal.woff +0 -0
  97. package/dist/assets/roboto-latin-300-normal.woff2 +0 -0
  98. package/dist/assets/roboto-latin-400-normal.woff +0 -0
  99. package/dist/assets/roboto-latin-400-normal.woff2 +0 -0
  100. package/dist/assets/roboto-latin-500-normal.woff +0 -0
  101. package/dist/assets/roboto-latin-500-normal.woff2 +0 -0
  102. package/dist/assets/roboto-latin-700-normal.woff +0 -0
  103. package/dist/assets/roboto-latin-700-normal.woff2 +0 -0
  104. package/dist/assets/roboto-latin-900-normal.woff +0 -0
  105. package/dist/assets/roboto-latin-900-normal.woff2 +0 -0
  106. package/dist/assets/roboto-latin-ext-100-normal.woff +0 -0
  107. package/dist/assets/roboto-latin-ext-100-normal.woff2 +0 -0
  108. package/dist/assets/roboto-latin-ext-300-normal.woff +0 -0
  109. package/dist/assets/roboto-latin-ext-300-normal.woff2 +0 -0
  110. package/dist/assets/roboto-latin-ext-400-normal.woff +0 -0
  111. package/dist/assets/roboto-latin-ext-400-normal.woff2 +0 -0
  112. package/dist/assets/roboto-latin-ext-500-normal.woff +0 -0
  113. package/dist/assets/roboto-latin-ext-500-normal.woff2 +0 -0
  114. package/dist/assets/roboto-latin-ext-700-normal.woff +0 -0
  115. package/dist/assets/roboto-latin-ext-700-normal.woff2 +0 -0
  116. package/dist/assets/roboto-latin-ext-900-normal.woff +0 -0
  117. package/dist/assets/roboto-latin-ext-900-normal.woff2 +0 -0
  118. package/dist/assets/roboto-vietnamese-100-normal.woff +0 -0
  119. package/dist/assets/roboto-vietnamese-100-normal.woff2 +0 -0
  120. package/dist/assets/roboto-vietnamese-300-normal.woff +0 -0
  121. package/dist/assets/roboto-vietnamese-300-normal.woff2 +0 -0
  122. package/dist/assets/roboto-vietnamese-400-normal.woff +0 -0
  123. package/dist/assets/roboto-vietnamese-400-normal.woff2 +0 -0
  124. package/dist/assets/roboto-vietnamese-500-normal.woff +0 -0
  125. package/dist/assets/roboto-vietnamese-500-normal.woff2 +0 -0
  126. package/dist/assets/roboto-vietnamese-700-normal.woff +0 -0
  127. package/dist/assets/roboto-vietnamese-700-normal.woff2 +0 -0
  128. package/dist/assets/roboto-vietnamese-900-normal.woff +0 -0
  129. package/dist/assets/roboto-vietnamese-900-normal.woff2 +0 -0
  130. package/dist/assets/types/select.item.type.js +1 -0
  131. package/dist/assets/ui/Icon.ui.js +1 -0
  132. package/dist/assets/ui/IconButton.ui.js +1 -0
  133. package/dist/assets/ui/Textbox.ui.js +1 -0
  134. package/dist/assets/ui/accordion.ui.js +1 -0
  135. package/dist/assets/ui/button.ui.js +1 -0
  136. package/dist/assets/ui/buttonColor.ui.js +1 -0
  137. package/dist/assets/ui/buttonmenu.ui.js +1 -0
  138. package/dist/assets/ui/buttonstack.ui.js +1 -0
  139. package/dist/assets/ui/checkbox.ui.js +1 -0
  140. package/dist/assets/ui/container.ui.js +1 -0
  141. package/dist/assets/ui/datagrid.ui.js +1 -0
  142. package/dist/assets/ui/dialog.js +1 -0
  143. package/dist/assets/ui/draggable.ui.js +1 -0
  144. package/dist/assets/ui/hpanel.ui.js +1 -0
  145. package/dist/assets/ui/iconButtonMenu.ui.js +1 -0
  146. package/dist/assets/ui/image.ui.js +1 -0
  147. package/dist/assets/ui/label.ui.js +1 -0
  148. package/dist/assets/ui/loading.ui.js +1 -0
  149. package/dist/assets/ui/menu.ui.js +1 -0
  150. package/dist/assets/ui/progressbar.ui.js +1 -0
  151. package/dist/assets/ui/radiobutton.ui.js +1 -0
  152. package/dist/assets/ui/scroll.ui.js +1 -0
  153. package/dist/assets/ui/select.ui.js +1 -0
  154. package/dist/assets/ui/styles/accordion.css +1 -0
  155. package/dist/assets/ui/styles/button.css +1 -0
  156. package/dist/assets/ui/styles/buttoncolor.css +1 -0
  157. package/dist/assets/ui/styles/container.css +1 -0
  158. package/dist/assets/ui/styles/datagrid.css +1 -0
  159. package/dist/assets/ui/styles/dialog.css +1 -0
  160. package/dist/assets/ui/styles/draggable.css +1 -0
  161. package/dist/assets/ui/styles/hpanel.css +1 -0
  162. package/dist/assets/ui/styles/icon.css +1 -0
  163. package/dist/assets/ui/styles/image.css +1 -0
  164. package/dist/assets/ui/styles/label.css +1 -0
  165. package/dist/assets/ui/styles/loading.css +1 -0
  166. package/dist/assets/ui/styles/main.css +1 -0
  167. package/dist/assets/ui/styles/menu.css +1 -0
  168. package/dist/assets/ui/styles/progressbar.css +1 -0
  169. package/dist/assets/ui/styles/scroll.css +1 -0
  170. package/dist/assets/ui/styles/select.css +1 -0
  171. package/dist/assets/ui/styles/stackbutton.css +1 -0
  172. package/dist/assets/ui/styles/tabs.css +1 -0
  173. package/dist/assets/ui/styles/textarea.css +1 -0
  174. package/dist/assets/ui/styles/textbox.css +1 -0
  175. package/dist/assets/ui/styles/toolbar.css +1 -0
  176. package/dist/assets/ui/styles/valuebar.css +1 -0
  177. package/dist/assets/ui/styles/vpanel.css +1 -0
  178. package/dist/assets/ui/styles/vstackbutton.css +1 -0
  179. package/dist/assets/ui/switch.ui.js +1 -0
  180. package/dist/assets/ui/tabs.ui.js +1 -0
  181. package/dist/assets/ui/textarea.ui.js +1 -0
  182. package/dist/assets/ui/toggle.ui.js +1 -0
  183. package/dist/assets/ui/toolbar.ui.js +1 -0
  184. package/dist/assets/ui/valuebar.ui.js +1 -0
  185. package/dist/assets/ui/vpanel.ui.js +1 -0
  186. package/dist/assets/ui/widget.builder.js +1 -0
  187. package/dist/assets/ui/widget.collection.js +1 -0
  188. package/dist/assets/ui/widget.ui.js +1 -0
  189. package/dist/cedro-logo.png +0 -0
  190. package/dist/cedro-logo.svg +97 -0
  191. package/dist/fangio.jpg +0 -0
  192. package/dist/material-icons-list.json/357/200/272Zone.Identifier +3 -0
  193. package/package.json +4 -2
  194. package/src/core/application.builder.tsx +122 -60
  195. package/src/core/application.core.tsx +110 -11
  196. package/src/core/themes.core.ts +160 -1
  197. package/src/core/uid.ts +3 -3
  198. package/src/interfaces/application.interface.ts +3 -2
  199. package/src/interfaces/widget.interface.ts +3 -0
  200. package/src/types/select.item.type.ts +11 -0
  201. package/src/ui/Icon.ui.tsx +158 -0
  202. package/src/ui/IconButton.ui.tsx +51 -9
  203. package/src/ui/{textbox.ui.tsx → Textbox.ui.tsx} +23 -15
  204. package/src/ui/accordion.ui.tsx +152 -0
  205. package/src/ui/button.ui.tsx +55 -14
  206. package/src/ui/buttonColor.ui.tsx +87 -0
  207. package/src/ui/buttonmenu.ui.tsx +133 -0
  208. package/src/ui/{buttonstack.ui.ts → buttonstack.ui.tsx} +67 -1
  209. package/src/ui/checkbox.ui.tsx +9 -13
  210. package/src/ui/container.ui.tsx +140 -76
  211. package/src/ui/datagrid.ui.tsx +514 -0
  212. package/src/ui/dialog.tsx +143 -56
  213. package/src/ui/hpanel.ui.tsx +37 -11
  214. package/src/ui/iconButtonMenu.ui.tsx +175 -0
  215. package/src/ui/image.ui.tsx +123 -112
  216. package/src/ui/index.ts +8 -8
  217. package/src/ui/label.ui.tsx +61 -3
  218. package/src/ui/loading.ui.ts +10 -10
  219. package/src/ui/menu.ui.ts +2 -2
  220. package/src/ui/progressbar.ui.tsx +9 -8
  221. package/src/ui/{radiobutton.tsx → radiobutton.ui.tsx} +9 -13
  222. package/src/ui/scroll.ui.ts +13 -12
  223. package/src/ui/select.ui.tsx +143 -0
  224. package/src/ui/styles/button.css +114 -32
  225. package/src/ui/styles/buttoncolor.css +8 -8
  226. package/src/ui/styles/container.css +29 -0
  227. package/src/ui/styles/icon.css +29 -0
  228. package/src/ui/styles/image.css +19 -19
  229. package/src/ui/styles/label.css +63 -0
  230. package/src/ui/styles/loading.css +12 -12
  231. package/src/ui/styles/main.css +5 -0
  232. package/src/ui/styles/progressbar.css +2 -1
  233. package/src/ui/styles/select.css +13 -0
  234. package/src/ui/styles/stackbutton.css +36 -0
  235. package/src/ui/styles/tabs.css +5 -7
  236. package/src/ui/styles/textarea.css +13 -13
  237. package/src/ui/switch.ui.tsx +9 -13
  238. package/src/ui/tabs.ui.tsx +43 -22
  239. package/src/ui/textarea.ui.tsx +48 -0
  240. package/src/ui/toolbar.ui.tsx +17 -12
  241. package/src/ui/valuebar.ui.tsx +11 -13
  242. package/src/ui/vpanel.ui.tsx +19 -13
  243. package/src/ui/widget.builder.ts +243 -159
  244. package/src/ui/widget.collection.ts +24 -2
  245. package/src/ui/widget.ui.ts +79 -19
  246. package/src/ui/Icon.ui.ts +0 -64
  247. package/src/ui/accordion.ui.ts +0 -71
  248. package/src/ui/buttonColor.ui.ts +0 -24
  249. package/src/ui/buttonmenu.ui.ts +0 -59
  250. package/src/ui/datagrid.ui.ts +0 -231
  251. package/src/ui/iconButtonMenu.ui.ts +0 -59
  252. package/src/ui/select.ui.ts +0 -73
  253. package/src/ui/textarea.ui.ts +0 -20
  254. /package/src/ui/{toggle.ui.ts → toggle.ui.tsx} +0 -0
@@ -0,0 +1 @@
1
+ var d=Object.defineProperty;var o=(e,i,t)=>i in e?d(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t;var h=(e,i,t)=>o(e,typeof i!="symbol"?i+"":i,t);import{DOMcreateElement as u}from"../core/jsxsupport.js";/* empty css */import{connectWidgetCallback as g,getOnlyEventProps as c,Widget as l}from"./widget.ui.js";import{Draggable as B}from"./draggable.ui.js";import{normalizeWidget as b}from"./widget.builder.js";import{UID as m}from"../core/uid.js";class v extends l{constructor(t,r="horizontal",a=null){super(t,"div",a);h(this,"orientation");h(this,"value");h(this,"containerBar");h(this,"bar");h(this,"handler");h(this,"draggable");this.containerBar=new l(t+".containerBar","div",this),this.bar=new l(t+".bar","div",this.containerBar),this.handler=new l(t+".handler","div",this),this.addClass("WUIValueBar"),this.containerBar.addClass("WUIValueBarContainer"),this.bar.addClass("WUIValueBarBar"),this.handler.addClass("WUIValueBarHandler"),this.draggable=new B(this.handler,r),this.handler.subscribe({event:"drag",then:(s,n)=>{this.updateValueFromHandlerPosition()}}),this.orientation=r,this.value=10,this.handler.raisteTop()}setValue(t){this.value=t,this.render()}getValue(){return this.value}updateValueFromHandlerPosition(){if(this.orientation==="horizontal"){const t=this.draggable.maxX?this.draggable.maxX:1,r=this.handler.getX()/t;this.value=Math.round(r*100)}else if(this.orientation==="vertical"){const t=this.draggable.maxY?this.draggable.maxY:1,r=this.handler.getY()/t;this.value=Math.round(r*100)}this.render()}render(){if(super.render(),this.orientation==="horizontal"){const a=this.getW()-3,s=this.getH(),n=a*(this.value/100);this.containerBar.setX(0),this.containerBar.setY(s/2-14/2),this.containerBar.setH(14),this.containerBar.setW(a),this.bar.setX(0),this.bar.setY(0),this.bar.setW(n),this.bar.setH(10),this.handler.setX(n-24+2),this.handler.setY(s/2-24/2),this.handler.setWH(24,24),this.draggable.setMinX(0),this.draggable.setMaxX(a-24+2)}else if(this.orientation==="vertical"){const a=this.getH()-3,s=this.getW(),n=a*(this.value/100);this.containerBar.setY(0),this.containerBar.setX(s/2-14/2),this.containerBar.setW(14),this.containerBar.setH(a),this.bar.setX(0),this.bar.setY(0),this.bar.setH(n),this.bar.setW(10),this.handler.setY(n-24+2),this.handler.setX(s/2-24/2),this.handler.setWH(24,24),this.draggable.setMinY(0),this.draggable.setMaxY(a-24+2)}}}const Y=e=>(e.id||(e.id="ValueBar."+m()),g(e.id,c(e)),b(u("div",{id:e.id,"w-valuebar":!0,"w-value":e.value}),e));function H(e,i,t=null){const r=i.getAttribute("w-orientation"),a=i.getAttribute("w-value");let s=r||"horizontal",n=new v(e,s,t);return a&&n.setValue(parseInt(a)),n}export{v as ValueBar,Y as WValueBar,H as createValueBar};
@@ -0,0 +1 @@
1
+ var u=Object.defineProperty;var c=(i,o,t)=>o in i?u(i,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[o]=t;var l=(i,o,t)=>c(i,typeof o!="symbol"?o+"":o,t);import{DOMcreateElement as m}from"../core/jsxsupport.js";import{Draggable as b}from"./draggable.ui.js";/* empty css */import{normalizeWidget as C,createWidget as H}from"./widget.builder.js";import{Widget as a,WidgetAlignTypes as f,WidgetTypes as g,connectWidgetCallback as Y,getOnlyEventProps as y}from"./widget.ui.js";const d=4;class S extends a{constructor(t,e=null){super(t,"div",e);l(this,"topContent");l(this,"bottomContent");l(this,"topHeight");l(this,"bottomHeight");l(this,"handler");l(this,"draggable");this.setAlign(f.VERTICAL),this.setType(g.FILL),this.handler=new a(t+".handler","div",null),this.handler.addClass("WUIVPanelHandler"),this.draggable=new b(this.handler,"vertical"),this.draggable.setDraggingClass("WUIVPanelDragging"),this.draggable.setBackgroundCursor("row-resize"),this.handler.subscribe({event:"drag",then:(s,n)=>{this.updateSizeFromHandlerPosition()}}),this.subscribe({event:"mousemove",then:(s,n)=>{this.updateHandlerOpacity(s)}}),this.topContent=null,this.bottomContent=null,this.topHeight=null,this.bottomHeight=null}updateHandlerOpacity(t){const e=this.handler.getY(),s=t.clientY,n=100,h=20,r=Math.abs(s-e);if(r<n&&r>h){const p=1-r/n;this.handler.getBody().style.opacity=p.toString()}else r<h?this.handler.getBody().style.opacity="1":this.handler.getBody().style.opacity="0"}setTop(t,e=null){this.topContent=t,this.topHeight=e,e!==null&&(this.bottomHeight=null,this.topContent.setFixedSize(e)),this.addChild(t);const s=new a("spacer."+Date.now().toString(),"div",null);s.setType(g.FILL),s.setFixedSize(d),this.addChild(s)}setBottom(t,e=null){this.bottomContent=t,this.bottomHeight=e,e!==null&&(this.topHeight=null,this.bottomContent.setFixedSize(e)),this.addChild(t)}updateSizeFromHandlerPosition(){if(this.topHeight!==null){const t=this.topContent?this.topContent.getY(!0):0;this.topHeight=this.handler.getY()-t}else this.bottomHeight!==null&&(this.bottomHeight=this.getH()-this.handler.getY());this.render()}render(){var t,e,s;if(super.render(),this.handler.setH(d),this.handler.setW(this.getW()),this.topHeight!==null){const n=this.topContent?this.topContent.getY(!0):0;this.handler.setY(n+this.topHeight),(t=this.topContent)==null||t.setFixedSize(this.topHeight)}else if(this.bottomHeight!==null){const n=this.bottomContent?this.bottomContent.getY(!0):0;this.handler.setY(n+this.bottomHeight),(e=this.bottomContent)==null||e.setFixedSize(this.bottomHeight)}else{this.topHeight===null&&(this.topHeight=this.getH()/2-d/2);const n=this.topContent?this.topContent.getY(!0):0;this.handler.setY(n+this.topHeight),(s=this.topContent)==null||s.setFixedSize(this.topHeight)}this.handler.setX(this.getX(!0))}free(){var t,e;this.handler.free(),(t=this.topContent)==null||t.free(),(e=this.bottomContent)==null||e.free(),super.free()}}const D=i=>(Y(i.id,y(i)),C(m("div",{"w-vpanel":!0},i.children),i));function E(i,o,t=null){let e=new S(i,t);return o.childNodes.forEach((s,n)=>{const h=H(s);h!==null&&(n===0?e.setTop(h,h.getFixedSize()):n===1&&e.setBottom(h))}),e}export{S as VPanel,D as WVPanel,E as createVPanel};
@@ -0,0 +1 @@
1
+ import{UID as d}from"../core/uid.js";import{WidgetTypes as l,Widget as b,WidgetAlignTypes as f}from"./widget.ui.js";import{addNewWidget as g}from"./widget.collection.js";import{createTextbox as A}from"./Textbox.ui.js";import{createButton as w}from"./button.ui.js";import{createLabel as x}from"./label.ui.js";import{createContainer as h}from"./container.ui.js";import{createIconButton as p}from"./IconButton.ui.js";import{createImage as y}from"./image.ui.js";import{createCheckbox as T}from"./checkbox.ui.js";import{createRadioButton as I}from"./radiobutton.ui.js";import{createToolbar as N}from"./toolbar.ui.js";import{createProgressBar as z}from"./progressbar.ui.js";import{createValueBar as B}from"./valuebar.ui.js";import{createVPanel as C,VPanel as S}from"./vpanel.ui.js";import{createHPanel as v,HPanel as E}from"./hpanel.ui.js";import{createTab as L,Tabs as P}from"./tabs.ui.js";import{createSwitch as R}from"./switch.ui.js";import{createAccordion as V,Accordion as c}from"./accordion.ui.js";import{createButtonStack as W}from"./buttonstack.ui.js";import{createButtonColor as D}from"./buttonColor.ui.js";import{createButtonMenu as F}from"./buttonmenu.ui.js";import{createIconButtonMenu as k}from"./iconButtonMenu.ui.js";import{createIcon as H}from"./Icon.ui.js";import{createTextarea as M}from"./textarea.ui.js";import{createSelect as O}from"./select.ui.js";import{createDialog as G,Dialog as u}from"./dialog.js";import{createDataGrid as U,DataGrid as o}from"./datagrid.ui.js";function Z(i,r=null,s=!1){if(!i.tagName)return null;let e=null,t={id:i.id?i.id:d(),type:i.getAttribute("w-type")===null?l.FILL:parseInt(i.getAttribute("w-type")),orientation:i.getAttribute("w-orientation")===null?"horizontal":i.getAttribute("w-orientation"),hidden:i.getAttribute("w-hidden")!==null,padding:i.getAttribute("w-padding")===null?0:parseInt(i.getAttribute("w-padding")),fixedSize:i.getAttribute("w-fixed-size")===null?null:parseInt(i.getAttribute("w-fixed-size")),classNames:i.getAttribute("w-classes")===null?null:i.getAttribute("w-classes")};if(t.id||(t.id=d()),i.getAttribute("w-textbox")?e=A(t.id,i,r):i.getAttribute("w-textarea")?e=M(t.id,i,r):i.getAttribute("w-button")?e=w(t.id,i,r):i.getAttribute("w-icon-button")?e=p(t.id,i,r):i.getAttribute("w-button-stack")?e=W(t.id,i,r):i.getAttribute("w-button-color")?e=D(t.id,i,r):i.getAttribute("w-button-menu")?e=F(t.id,i,r):i.getAttribute("w-icon-button-menu")?e=k(t.id,i,r):i.getAttribute("w-label")?e=x(t.id,i,r):i.getAttribute("w-image")?e=y(t.id,i,r):i.getAttribute("w-icon")?e=H(t.id,i,r):i.getAttribute("w-checkbox")?e=T(t.id,i,r):i.getAttribute("w-radiobutton")?e=I(t.id,i,r):i.getAttribute("w-switch")?e=R(t.id,i,r):i.getAttribute("w-toolbar")?e=N(t.id,i,r):i.getAttribute("w-progressbar")?e=z(t.id,i,r):i.getAttribute("w-valuebar")?e=B(t.id,i,r):i.getAttribute("w-tab")?e=L(t.id,i,r):i.getAttribute("w-accordion")?e=V(t.id,i,r):i.getAttribute("w-vpanel")?e=C(t.id,i,r):i.getAttribute("w-hpanel")?e=v(t.id,i,r):i.getAttribute("w-container")?e=h(i,r):i.getAttribute("w-select")?e=O(t.id,i,r):i.getAttribute("w-dialog")?e=G(t.id,i,null):i.getAttribute("w-data-grid")?e=U(t.id,i,r):(e=new b(t.id,i.tagName,r),t.type===l.FREE&&(s=!0),i.getAttributeNames().forEach(a=>{e&&e.getBody().setAttribute(a,i.getAttribute(a))}),i.childNodes.forEach(a=>{a.hasChildNodes()==!0?Z(a,e,s):e&&e.getBody().appendChild(a)})),e){if(!s&&t.type?e.setType(t.type):e.setType(l.FREE),e instanceof u&&e.setType(l.CUSTOM),t.orientation&&!(e instanceof S)&&!(e instanceof E)&&!(e instanceof u)&&!(e instanceof o)&&!(e instanceof P)&&(t.orientation==="vertical"?e.setAlign(f.VERTICAL):e.setAlign(f.HORIZONTAL)),e instanceof c&&e.setAlign(f.VERTICAL),e instanceof o&&e.setAlign(f.VERTICAL),t.padding&&e.setPadding(t.padding),t.fixedSize&&e.setFixedSize(t.fixedSize),t.classNames){const a=t.classNames.split(" ");for(const m of a)e.addClass(m)}return t.hidden&&e.setVisible(!1),g(t.id,e),e}return null}function pi(i,r){return r.fixedSize!==void 0&&i.setAttribute("w-fixed-size",r.fixedSize),r.padding!==void 0&&i.setAttribute("w-padding",r.padding),r.type!==void 0&&i.setAttribute("w-type",r.type),r.hidden!==void 0&&i.setAttribute("w-hidden",r.hidden),r.classNames!==void 0&&i.setAttribute("w-classes",r.classNames),r.orientation!==void 0&&i.setAttribute("w-orientation",r.orientation),i}export{Z as createWidget,pi as normalizeWidget};
@@ -0,0 +1 @@
1
+ const i=()=>{window.w||(window.w=new Map,w=window.w),o()},o=()=>{window.widgetConnections||(window.widgetConnections=new Map),window.widgetCustomConnections||(window.widgetCustomConnections=new Map)},c=(n,t)=>{i(),w.get(n)||w.set(n,t),setTimeout(()=>{s("widget-added-"+n),d("widget-custom-added-"+n)})},C=(n,t)=>{o(),widgetConnections.set(n,t)},g=(n,t)=>{o(),widgetCustomConnections.set(n,t)},s=n=>{for(const[t,e]of widgetConnections.entries())t==n&&e.then(new Event(n),null);widgetConnections.delete(n)},d=n=>{for(const[t,e]of widgetCustomConnections.entries())t==n&&e.then(new Event(n),null);widgetCustomConnections.delete(n)};export{c as addNewWidget,g as connectCustomWidget,C as connectWidget,i as initWidgetCollection,o as initWidgetConnections,s as run,d as runCustom};
@@ -0,0 +1 @@
1
+ var f=Object.defineProperty;var b=(i,e,t)=>e in i?f(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var d=(i,e,t)=>b(i,typeof e!="symbol"?e+"":e,t);import{UID as y}from"../core/uid.js";import{addNewWidget as c,connectWidget as g}from"./widget.collection.js";var v=(i=>(i[i.FILL=1]="FILL",i[i.CUSTOM=2]="CUSTOM",i[i.FREE=3]="FREE",i))(v||{}),m=(i=>(i[i.HORIZONTAL=1]="HORIZONTAL",i[i.VERTICAL=2]="VERTICAL",i))(m||{});class M{constructor(e="",t="div",h=null){d(this,"id");d(this,"subscribers");d(this,"padding");d(this,"left");d(this,"top");d(this,"width");d(this,"height");d(this,"initialWidth");d(this,"initialHeight");d(this,"overflow");d(this,"fixedSize");d(this,"type");d(this,"align");d(this,"visible");d(this,"enabled");d(this,"parent");d(this,"childs");d(this,"bodyTagName");d(this,"body");this.id=e||y(),this.overflow=!1,this.subscribers=new Map,this.padding=0,this.left=0,this.top=0,this.width=0,this.height=0,this.initialWidth=0,this.initialHeight=0,this.fixedSize=null,this.type=3,this.align=2,this.visible=!0,this.enabled=!0,this.parent=h,this.childs=[],this.bodyTagName=t,this.body=document.createElement(this.bodyTagName),this.body.id=`WUI.${e}.body`,h?(h.addChild(this),h.getBody().appendChild(this.body)):(this.setType(3),document.body.appendChild(this.body)),this.body.addEventListener("click",s=>{this.subscribers.forEach(n=>{n.event=="click"&&n.then(s,this)})}),this.body.addEventListener("mousedown",s=>{this.subscribers.forEach(n=>{n.event=="mousedown"&&n.then(s,this)})}),this.body.addEventListener("mouseup",s=>{this.subscribers.forEach(n=>{n.event=="mouseup"&&n.then(s,this)})}),this.body.addEventListener("mousemove",s=>{this.subscribers.forEach(n=>{n.event=="mousemove"&&n.then(s,this)})}),this.body.addEventListener("wheel",s=>{this.subscribers.forEach(n=>{n.event=="wheel"&&n.then(s,this)})}),this.body.addEventListener("mouseout",s=>{this.subscribers.forEach(n=>{n.event=="mouseout"&&n.then(s,this)})}),this.body.addEventListener("mouseleave",s=>{this.subscribers.forEach(n=>{n.event=="mouseleave"&&n.then(s,this)})}),this.init(),this.getMaxZIndex(),c(this.id,this)}run(e){this.subscribers.forEach(t=>{t.event==e&&t.then(new Event(e),this)})}subscribe(e){const t=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15);this.subscribers.set(`${t}.${e.event}`,e)}unsubscribe(e){this.subscribers.delete(`${e}`)}setPadding(e){this.padding=e}setX(e){this.left=e,this.body.style.left=`${e}px`}setY(e){this.top=e,this.body.style.top=`${e}px`}setW(e){this.body.style.width=`${e}px`}setInitialW(e){this.initialWidth=e}setH(e){this.body.style.height=`${e}px`}setInitialH(e){this.initialHeight=e}setWH(e,t){this.width=e,this.height=t,this.body.style.width=`${e}px`,this.body.style.height=`${t}px`,this.subscribers.forEach(h=>{h.event=="resize"&&h.then(new Event("resize"),this)})}setFixedSize(e){this.fixedSize=e}setType(e){this.type=e;let t=!1;this.type===3&&(t=!0);const h=this.getParent();h&&h.type===3&&(t=!0),t?(this.deleteClass("WUINonFreePosition"),this.addClass("WUIFixPosition"),this.body.style.left="",this.body.style.top="",this.body.style.width="",this.body.style.height="",this.body.style.bottom="",this.body.style.right=""):(this.type===2||this.type===1)&&(this.deleteClass("WUIFixPosition"),this.addClass("WUINonFreePosition")),this.initialWidth!=0&&(this.body.style.width=`${this.initialWidth}px`),this.initialHeight!=0&&(this.body.style.height=`${this.initialHeight}px`)}setAlign(e){this.align=e}setVisible(e){this.visible=e,this.body.style.display=e?"":"none"}setEnabled(e){this.enabled=e}setParent(e){var t;this.parent&&this.body&&this.body.parentNode&&this.body.parentNode.removeChild(this.body),this.parent=e,(t=this.parent)==null||t.body.appendChild(this.body),this.setType(this.type)}setBody(e){var t;this.body.parentNode&&this.body.parentNode.removeChild(this.body),this.body=e,(t=this.parent)==null||t.getBody().appendChild(this.body)}setChilds(e){this.childs=e}setOverflow(e){this.overflow=e,this.getBody().style.overflow=this.overflow?"auto":"hidden"}addClass(e){this.body.classList.add(e)}deleteClass(e){this.body.classList.remove(e)}deleteAllClasses(){this.body.classList.forEach(e=>{this.deleteClass(e)})}getPadding(){return this.padding}getX(e=!1){if(!e)return this.left;const t=this.getParent();return t?this.left+t.getX(!0):this.left}getY(e=!1){if(!e)return this.top;const t=this.getParent();return t?this.top+t.getY(!0):this.top}getW(){return this.getBody().clientWidth}getH(){return this.getBody().clientHeight}getPosition(e=!1){var t=this.getBody().getBoundingClientRect(),h=document.body,s=document.documentElement,n=e?s.scrollTop||h.scrollTop:0,l=e?s.scrollLeft||h.scrollLeft:0,u=s.clientTop||h.clientTop||0,a=s.clientLeft||h.clientLeft||0,o=t.top+n-u,r=t.left+l-a;return{x:Math.round(r),y:Math.round(o)}}getFixedSize(){return this.fixedSize}getType(){return this.type}getAlign(){return this.align}getEnabled(){return this.enabled}getVisible(){return this.visible}getParent(){return this.parent}getBody(){return this.body}getChilds(){return this.childs}getOverflow(){return this.overflow}addChild(e=null){e&&(this.childs.push(e),e.setParent(this),e.init())}populate(){window.w.get(this.id)||window.w.set(this.id,this);for(const e of this.childs)e.populate()}disableSelection(){console.log("disableSelection")}enableSelection(){console.log("enableSelection")}hide(){this.setVisible(!1)}init(){let e=!1;this.type===3&&(e=!0);const t=this.getParent();t&&t.type===3&&(e=!0),e||(this.deleteClass("WUIFixPosition"),this.addClass("WUINonFreePosition")),this.initPosition()}initPosition(){if(this.type===1)if(!this.parent)this.setX(0),this.setY(0),this.setWH(window.innerWidth,window.innerHeight);else return}render(){const e=this.padding,t=this.align===1?this.width:this.height;let h=e,s=0,n=0;for(const o of this.childs)o.type===1&&n++;let l=n;for(const o of this.childs)o.getFixedSize()!==null&&(s+=o.getFixedSize(),l--);let u=t-s;const a=this.getParent();a&&a.type===3&&(this.addClass("WUIFixPosition"),this.getBody().style.left="",this.getBody().style.top="",this.getBody().style.height="",this.getBody().style.width="",this.initialWidth!=0&&(this.getBody().style.width=`${this.initialWidth}px`),this.initialHeight!=0&&(this.getBody().style.height=`${this.initialHeight}px`));for(const o of this.childs){if(o.type!==1){o.render();continue}let r=(u-e)/l;o.getFixedSize()!==null&&(r=o.getFixedSize()),this.align===1?(o.setY(e),o.setX(h),o.type===1?o.setWH(r-e,this.getH()-e*2):o.setWH(r-e,this.getH()-e*2)):this.align===2&&(o.setX(e),o.setY(h),o.type===1?o.setWH(this.getW()-e*2,r-e):o.setWH(this.getW()-e*2,r-e)),h+=r,o.render()}this.subscribers.forEach(o=>{o.event=="render"&&o.then(new Event("render"),this)})}resize(){this.initPosition(),this.render()}display(){this.setVisible(!0)}toggle(){this.setVisible(!this.visible)}renderHTML(e){return this.body.appendChild(e),e}getMaxZIndex(e=0,t=null){const h=t||document.body;return h instanceof HTMLElement&&parseInt(window.getComputedStyle(h).zIndex)>e&&(e=parseInt(window.getComputedStyle(h).zIndex)),h==null||h.childNodes.forEach(s=>{e=this.getMaxZIndex(e,s)}),e}setZIndex(e){this.getBody().style.zIndex=`${e}`}raisteTop(){this.setZIndex(this.getMaxZIndex()+1)}raiseBottom(){this.setZIndex(0)}attachWidget(e){this.removeAllChilds(),this.addChild(e),e.setParent(this),e.render(),this.resize(),this.render()}removeAllChilds(){for(;this.getBody().childNodes.length>0;){const e=this.getBody().firstChild;e&&this.getBody().removeChild(e)}this.childs=[]}free(){if(this.childs)for(const h of this.childs)h.free();window.w.delete(this.id);const e=this.getBody(),t=e.parentNode;!t&&!e||t==null||t.removeChild(e)}dispose(){this.removeAllChilds();const e=this.getBody(),t=e.parentNode;t==null||t.removeChild(e)}}function x(i){return{onClick:i.onClick,onDrag:i.onDrag,onResize:i.onResize,onMouseDown:i.onMouseDown,onMouseUp:i.onMouseUp,onMouseMove:i.onMouseMove,onMouseOut:i.onMouseOut,onMouseLeave:i.onMouseLeave,onWheel:i.onWheel,onRender:i.onRender}}function L(i,e){i&&g("widget-added-"+i,{event:"widget-load",then:(t,h)=>{const s=w.get(i);s&&(s.subscribe({event:"click",then:(n,l)=>{e.onClick&&e.onClick({})}}),s.subscribe({event:"drag",then:(n,l)=>{e.onDrag&&e.onDrag({})}}),s.subscribe({event:"resize",then:(n,l)=>{e.onResize&&e.onResize({})}}),s.subscribe({event:"mousedown",then:(n,l)=>{e.onMouseDown&&e.onMouseDown({})}}),s.subscribe({event:"mouseup",then:(n,l)=>{e.onMouseUp&&e.onMouseUp({})}}),s.subscribe({event:"mousemove",then:(n,l)=>{e.onMouseMove&&e.onMouseMove({})}}),s.subscribe({event:"mouseout",then:(n,l)=>{e.onMouseOut&&e.onMouseOut({})}}),s.subscribe({event:"mouseleave",then:(n,l)=>{e.onMouseLeave&&e.onMouseLeave({})}}),s.subscribe({event:"wheel",then:(n,l)=>{e.onWheel&&e.onWheel({})}}),s.subscribe({event:"render",then:(n,l)=>{e.onRender&&e.onRender({})}}))}})}export{M as Widget,m as WidgetAlignTypes,v as WidgetTypes,L as connectWidgetCallback,x as getOnlyEventProps};
Binary file
@@ -0,0 +1,97 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Created with Inkscape (http://www.inkscape.org/) -->
3
+
4
+ <svg
5
+ width="63.999996"
6
+ height="63.999996"
7
+ viewBox="0 0 16.933332 16.933332"
8
+ version="1.1"
9
+ id="svg1"
10
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
11
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
12
+ xmlns:xlink="http://www.w3.org/1999/xlink"
13
+ xmlns="http://www.w3.org/2000/svg"
14
+ xmlns:svg="http://www.w3.org/2000/svg">
15
+ <sodipodi:namedview
16
+ id="namedview1"
17
+ pagecolor="#ffffff"
18
+ bordercolor="#000000"
19
+ borderopacity="0.25"
20
+ inkscape:showpageshadow="2"
21
+ inkscape:pageopacity="0.0"
22
+ inkscape:pagecheckerboard="0"
23
+ inkscape:deskcolor="#d1d1d1"
24
+ inkscape:document-units="mm" />
25
+ <defs
26
+ id="defs1">
27
+ <linearGradient
28
+ inkscape:collect="always"
29
+ xlink:href="#linearGradient43"
30
+ id="linearGradient4-4-2-8-2"
31
+ x1="-2.3303316"
32
+ y1="4.1695919"
33
+ x2="35.675308"
34
+ y2="27.438389"
35
+ gradientUnits="userSpaceOnUse" />
36
+ <linearGradient
37
+ id="linearGradient43"
38
+ inkscape:collect="always">
39
+ <stop
40
+ style="stop-color:#c55a36;stop-opacity:1;"
41
+ offset="0"
42
+ id="stop41" />
43
+ <stop
44
+ style="stop-color:#653916;stop-opacity:1;"
45
+ offset="1"
46
+ id="stop43" />
47
+ </linearGradient>
48
+ </defs>
49
+ <g
50
+ inkscape:label="Capa 1"
51
+ inkscape:groupmode="layer"
52
+ id="layer1">
53
+ <g
54
+ id="g43-97"
55
+ inkscape:label="logo"
56
+ transform="matrix(0.35787036,0,0,0.35787036,-28.673691,-14.901542)">
57
+ <path
58
+ sodipodi:type="star"
59
+ style="fill:url(#linearGradient4-4-2-8-2);fill-opacity:1;stroke-width:0.264583"
60
+ id="path3-9-1-9-3"
61
+ inkscape:flatsided="true"
62
+ sodipodi:sides="6"
63
+ sodipodi:cx="14.4682"
64
+ sodipodi:cy="10.85115"
65
+ sodipodi:r1="33.404415"
66
+ sodipodi:r2="28.929071"
67
+ sodipodi:arg1="1.0471976"
68
+ sodipodi:arg2="1.5707963"
69
+ inkscape:rounded="-8.6736174e-17"
70
+ inkscape:randomized="0"
71
+ d="m 31.170406,39.780222 -33.4044152,-1e-6 -16.7022058,-28.929073 16.7022086,-28.929071 33.4044154,10e-7 16.702206,28.929073 z"
72
+ transform="matrix(0.61335724,0.35412196,-0.35412196,0.61335724,98.750054,53.518832)"
73
+ inkscape:label="hexagon" />
74
+ <g
75
+ id="g24-0-1-8"
76
+ transform="matrix(-0.10705088,-1.1567783,1.1567783,-0.10705088,-42.580249,112.06565)"
77
+ style="fill:#f3e6c6;fill-opacity:1"
78
+ inkscape:label="nut">
79
+ <path
80
+ style="fill:#f3e6c6;fill-opacity:1;stroke-width:0.205808"
81
+ d="m 37.695391,137.67201 c -4.335995,0.12348 -8.322511,-0.1629 -11.716092,-1.8082 -3.88948,-1.88571 -3.172757,-3.90894 -4.3329,-4.71833 -1.160142,-0.80938 -2.396324,-0.45638 -3.605738,-1.29419 -0.603327,3.56778 0.585177,7.57188 3.574494,9.76572 2.475445,1.94075 5.836913,2.56868 8.869641,1.79277 2.655797,-0.6397 5.120805,-1.99503 7.210595,-3.73777 z"
82
+ id="path5-29-8-8"
83
+ sodipodi:nodetypes="csscccc" />
84
+ <path
85
+ style="fill:#f3e6c6;fill-opacity:1;stroke-width:0.205808"
86
+ d="m 18.498269,128.08787 c 3.295382,-2.82073 6.576454,-5.10303 10.250209,-5.95563 4.210585,-0.97721 4.924417,1.04705 6.335504,0.94765 1.411079,-0.0994 2.150886,-1.1508 3.618159,-1.25904 -1.772618,-3.15451 -5.21328,-5.52246 -8.917253,-5.3506 -3.145193,0.0458 -6.154665,1.66966 -8.026256,4.17897 -1.663968,2.16649 -2.729828,4.76978 -3.260363,7.43865 z"
87
+ id="path5-2-2-5-2"
88
+ sodipodi:nodetypes="csscccc" />
89
+ <path
90
+ style="fill:#f3e6c6;fill-opacity:1;stroke-width:0.168787"
91
+ d="m 37.926149,126.16714 c -4.099583,0.20247 -10.320435,-0.90098 -11.157646,2.98893 -0.837211,3.88992 6.600086,3.11085 11.595712,6.01708 1.249664,-1.53842 1.810365,-3.89641 1.639598,-5.55579 -0.170766,-1.65938 -0.955994,-2.63481 -2.077664,-3.45022 z"
92
+ id="path6-9-7-2"
93
+ sodipodi:nodetypes="czczc" />
94
+ </g>
95
+ </g>
96
+ </g>
97
+ </svg>
Binary file
@@ -0,0 +1,3 @@
1
+ [ZoneTransfer]
2
+ ZoneId=3
3
+ HostUrl=https://github.com/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cedro",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "type": "module",
5
5
  "devDependencies": {
6
6
  "@types/node": "^20.4.4",
@@ -11,8 +11,10 @@
11
11
  "@oothkoo/seo-js": "1.0.5",
12
12
  "@types/color": "3.0.3",
13
13
  "@types/react": "18.2.17",
14
+ "html-entities": "^2.5.2",
14
15
  "color": "4.2.3",
15
- "material-icons": "1.13.9",
16
+ "glob": "^11.0.0",
17
+ "material-icons": "1.13.12",
16
18
  "navigo": "8.11.1"
17
19
  }
18
20
  }
@@ -1,60 +1,122 @@
1
- //import { createWidget } from "src/ui/builder/widget.builder";
2
- import { WidgetAlignTypes } from "../ui";
3
- import { createWidget } from "../ui/widget.builder";
4
- import Application, { ApplicationProps } from "./application.core";
5
-
6
- function getApplicationProps(content: any): ApplicationProps {
7
- let props: ApplicationProps = {
8
- title: content.title,
9
- padding: 0,
10
- orientation: null,
11
- children: null,
12
- };
13
-
14
- if (content.getAttribute("w-title") !== null) {
15
- props.title = content.getAttribute("w-title");
16
- }
17
-
18
- if (content.getAttribute("w-padding") !== null) {
19
- props.padding = parseInt(content.getAttribute("w-padding"));
20
- }
21
-
22
- if (content.getAttribute("w-orientation") !== null) {
23
- props.orientation = content.getAttribute("w-orientation");
24
- }
25
-
26
- return props;
27
- }
28
-
29
- export function createApplication(content: any): Application {
30
- const appProps = getApplicationProps(content);
31
- const newApp = new Application(appProps.title);
32
-
33
- if (appProps.padding) {
34
- newApp.getRoot().setPadding(appProps.padding);
35
- }
36
-
37
- if (appProps.orientation) {
38
- if (appProps.orientation === "horizontal") {
39
- newApp.getRoot().setAlign(WidgetAlignTypes.HORIZONTAL);
40
- } else {
41
- newApp.getRoot().setAlign(WidgetAlignTypes.VERTICAL);
42
- }
43
- }
44
-
45
- content.childNodes.forEach((item: HTMLElement) => {
46
- if (item.getAttribute("w-widget-collection")) {
47
- item.childNodes.forEach((ietmWidget: any) => {
48
- const appWidgets = createWidget(ietmWidget);
49
-
50
- if (appWidgets !== null) {
51
- newApp.getRoot().addChild(appWidgets);
52
- }
53
- });
54
- } else if (item.getAttribute("w-routes")) {
55
- console.log("routes:", item);
56
- }
57
- });
58
-
59
- return newApp;
60
- }
1
+ //import { createWidget } from "src/ui/builder/widget.builder";
2
+ import { Widget, WidgetAlignTypes } from "../ui";
3
+ import { createWidget } from "../ui/widget.builder";
4
+ import Application, { ApplicationProps } from "./application.core";
5
+ import { decode } from "html-entities";
6
+
7
+ function getApplicationProps(content: any): ApplicationProps {
8
+ let props: ApplicationProps = {
9
+ title: content.title,
10
+ padding: 0,
11
+ theme: null,
12
+ orientation: null,
13
+ children: null,
14
+ };
15
+
16
+ if (content.getAttribute("w-title") !== null) {
17
+ props.title = content.getAttribute("w-title");
18
+ }
19
+
20
+ if (content.getAttribute("w-padding") !== null) {
21
+ props.padding = parseInt(content.getAttribute("w-padding"));
22
+ }
23
+
24
+ if (content.getAttribute("w-orientation") !== null) {
25
+ props.orientation = content.getAttribute("w-orientation");
26
+ }
27
+
28
+ if (content.getAttribute("w-theme") !== null) {
29
+ props.theme = content.getAttribute("w-theme");
30
+ }
31
+
32
+ return props;
33
+ }
34
+
35
+ export function createApplication(content: any): Application {
36
+ const appProps = getApplicationProps(content);
37
+ const newApp = new Application(appProps.title);
38
+
39
+ if (appProps.padding) {
40
+ newApp.getRoot().setPadding(appProps.padding);
41
+ }
42
+
43
+ if (appProps.orientation) {
44
+ if (appProps.orientation === "horizontal") {
45
+ newApp.getRoot().setAlign(WidgetAlignTypes.HORIZONTAL);
46
+ } else {
47
+ newApp.getRoot().setAlign(WidgetAlignTypes.VERTICAL);
48
+ }
49
+ }
50
+
51
+ if (appProps.theme) {
52
+ newApp.theme.setTheme(appProps.theme);
53
+ }
54
+
55
+ content.childNodes.forEach((item: HTMLElement) => {
56
+ if (item.getAttribute("w-widget-collection")) {
57
+ item.childNodes.forEach((ietmWidget: any) => {
58
+ const appWidgets = createWidget(ietmWidget);
59
+
60
+ if (appWidgets !== null) {
61
+ newApp.getRoot().addChild(appWidgets);
62
+ }
63
+ });
64
+ } else if (item.getAttribute("w-routes")) {
65
+ newApp.setRouterHostId(item.getAttribute("w-host-id"));
66
+ item.childNodes.forEach((ietmRoute: any) => {
67
+ if (ietmRoute.getAttribute("w-route-path") && ietmRoute.getAttribute("href")) {
68
+ newApp.router.on(decode(ietmRoute.getAttribute("href")), () => {
69
+ const url = decode(ietmRoute.getAttribute("href"));
70
+ const timestamp = new Date().getTime();
71
+ const isProduction = process.env.NODE_ENV === "production";
72
+
73
+ const pathDev = ".." + url + "?ts=" + timestamp;
74
+
75
+ const pathProduction = `../../assets${decode(
76
+ ietmRoute.getAttribute("href")
77
+ )}/index.js?ts=${timestamp}`;
78
+
79
+ const path = isProduction ? pathProduction : pathDev;
80
+
81
+ import(/*@vite-ignore*/ path).then((module) => {
82
+ newApp.clearLoadedModule();
83
+ newApp.setLoadedModule(module.default);
84
+ const host = w.get(newApp.getRouterHostId());
85
+ if (host) {
86
+ newApp.attachWidget(newApp.getLoadedModule() as Widget, host);
87
+ }
88
+ newApp.hideLoading();
89
+ });
90
+
91
+ const loadCss = async () => {
92
+ try {
93
+ const timestamp = new Date().getTime();
94
+ //const cssName = "../../assets" + url + "/style.css?ts=" + timestamp;
95
+ const cssName = "/assets" + url + "/style.css?ts=" + timestamp;
96
+
97
+ // Crear un elemento <link> para cargar el CSS
98
+ const link = document.createElement("link");
99
+ link.rel = "stylesheet";
100
+ link.href = cssName;
101
+ document.head.appendChild(link);
102
+ } catch (error) {
103
+ console.log(error);
104
+ }
105
+ };
106
+
107
+ if (isProduction) loadCss();
108
+ });
109
+ }
110
+ });
111
+ newApp.router.resolve();
112
+ }
113
+ });
114
+
115
+ appConnections.forEach((cb) => {
116
+ newApp.subscribe(cb);
117
+ });
118
+
119
+ appConnections = [];
120
+
121
+ return newApp;
122
+ }
@@ -14,10 +14,20 @@ import Navigo from "navigo";
14
14
  import { Dialog } from "../ui/dialog";
15
15
  import { Label } from "../ui/label.ui";
16
16
  import { Seo } from "./seo";
17
- import { DarkTheme, LightTheme, ThemeManager } from "./themes.core";
17
+ import {
18
+ CedroLightTheme,
19
+ CedroDarkTheme,
20
+ DarkTheme,
21
+ LightTheme,
22
+ ThemeManager,
23
+ } from "./themes.core";
18
24
  import { Loading } from "../ui/loading.ui";
19
25
  import { OrientationTypes } from "../types/orientation.type";
20
26
 
27
+ declare global {
28
+ var appConnections: Array<WUICallback>;
29
+ }
30
+
21
31
  class WApplication implements IApplication {
22
32
  seo: Seo;
23
33
 
@@ -26,6 +36,7 @@ class WApplication implements IApplication {
26
36
  screen: Screen;
27
37
  root: Widget;
28
38
  router: Navigo;
39
+ routerHostId: string;
29
40
 
30
41
  alertDialog: Dialog;
31
42
  confirmDialog: Dialog;
@@ -35,6 +46,8 @@ class WApplication implements IApplication {
35
46
 
36
47
  theme: ThemeManager;
37
48
 
49
+ loadedModule: any;
50
+
38
51
  constructor(title: string) {
39
52
  this.seo = new Seo(title);
40
53
 
@@ -45,12 +58,15 @@ class WApplication implements IApplication {
45
58
  this.root.setType(WidgetTypes.FILL);
46
59
  this.screen = new Screen();
47
60
  this.router = new Navigo("/");
61
+ this.routerHostId = this.getRoot().id;
48
62
 
49
63
  this.mediaQueries = new Map<string, IScreenSize>();
50
64
 
51
65
  this.theme = new ThemeManager();
52
66
  this.theme.add(LightTheme);
53
67
  this.theme.add(DarkTheme);
68
+ this.theme.add(CedroDarkTheme);
69
+ this.theme.add(CedroLightTheme);
54
70
 
55
71
  this.screen.onResize(() => {
56
72
  this.getRoot().resize();
@@ -62,6 +78,12 @@ class WApplication implements IApplication {
62
78
  this.run("load");
63
79
  });
64
80
 
81
+ window.addEventListener("resize", () => {
82
+ this.screen.updateSize();
83
+ this.getRoot().resize();
84
+ this.run("resize");
85
+ });
86
+
65
87
  this.alertDialog = new Dialog("Dialog.alert", null);
66
88
  this.confirmDialog = new Dialog("Dialog.confirm", null);
67
89
 
@@ -70,6 +92,30 @@ class WApplication implements IApplication {
70
92
  this.theme.load();
71
93
  }
72
94
 
95
+ public setLoadedModule(module: any): void {
96
+ this.loadedModule = module;
97
+ }
98
+
99
+ public getLoadedModule(): any {
100
+ return this.loadedModule;
101
+ }
102
+
103
+ public clearLoadedModule(): void {
104
+ this.loadedModule = null;
105
+ }
106
+
107
+ public setRouterHostId(id: string | null): void {
108
+ if (!id) {
109
+ this.routerHostId = this.getRoot().id;
110
+ return;
111
+ }
112
+ this.routerHostId = id;
113
+ }
114
+
115
+ public getRouterHostId(): string {
116
+ return this.routerHostId;
117
+ }
118
+
73
119
  public run(eventId: WUIEvent): void {
74
120
  this.subscribers.forEach((callback) => {
75
121
  if (callback.event == eventId) {
@@ -90,13 +136,20 @@ class WApplication implements IApplication {
90
136
  this.subscribers.delete(`${event}`);
91
137
  }
92
138
 
93
- alert(msg: string, onOk: () => void = () => {}, onCancell: () => void = () => {}): void {
139
+ public alert(
140
+ title: string = "",
141
+ msg: string,
142
+ onOk: () => void = () => {},
143
+ onCancell: () => void = () => {}
144
+ ): void {
94
145
  const mesageLabel = new Label("alert.label", "span");
95
146
 
96
147
  mesageLabel.setType(WidgetTypes.FILL);
97
148
  mesageLabel.setAlign(WidgetAlignTypes.VERTICAL);
98
149
  mesageLabel.setText(msg);
99
150
 
151
+ this.alertDialog.titleBar.setText(title);
152
+
100
153
  this.alertDialog.setOkCallback({ event: "click", then: onOk });
101
154
  this.alertDialog.setCancellCallback({
102
155
  event: "click",
@@ -108,7 +161,11 @@ class WApplication implements IApplication {
108
161
  this.alertDialog.show();
109
162
  }
110
163
 
111
- confirm(msg: string, onOk: () => void = () => {}, onCancell: () => void = () => {}): void {
164
+ public confirm(
165
+ msg: string,
166
+ onOk: () => void = () => {},
167
+ onCancell: () => void = () => {}
168
+ ): void {
112
169
  const mesageLabel = new Label("alert.label", "span");
113
170
 
114
171
  mesageLabel.setType(WidgetTypes.FILL);
@@ -126,10 +183,16 @@ class WApplication implements IApplication {
126
183
  this.confirmDialog.show();
127
184
  }
128
185
 
129
- attachWidget(guest: IWidget, host: IWidget): void {
186
+ public attachWidget(guest: IWidget, host: IWidget): void {
130
187
  if (!host) {
131
188
  console.log("guest:", guest);
189
+ return;
132
190
  }
191
+
192
+ if (!guest) {
193
+ return;
194
+ }
195
+
133
196
  for (const child of host.getBody().childNodes) {
134
197
  child.parentNode?.removeChild(child);
135
198
  }
@@ -141,13 +204,14 @@ class WApplication implements IApplication {
141
204
  host.removeAllChilds();
142
205
 
143
206
  host.addChild(guest);
207
+ guest.populate(); //tiene que recorrer todos los widgets hijos en forma recursiva e ir agregandolos a window.w
144
208
  guest.setParent(host);
145
209
  guest.render();
146
210
  this.root.resize();
147
211
  this.root.render();
148
212
  }
149
213
 
150
- addMediaQuery(
214
+ public addMediaQuery(
151
215
  query: string,
152
216
  minWidth: number,
153
217
  maxWidth: number,
@@ -161,7 +225,7 @@ class WApplication implements IApplication {
161
225
  *
162
226
  * @return {void} This function does not return a value.
163
227
  */
164
- init(): void {
228
+ public init(): void {
165
229
  this.root.subscribe({
166
230
  event: "resize",
167
231
  then: () => {
@@ -186,7 +250,7 @@ class WApplication implements IApplication {
186
250
  *
187
251
  * @return {Widget} The root widget of the application.
188
252
  */
189
- getRoot(): Widget {
253
+ public getRoot(): Widget {
190
254
  return this.root;
191
255
  }
192
256
 
@@ -196,7 +260,7 @@ class WApplication implements IApplication {
196
260
  * @param {Widget} root - The root widget to set.
197
261
  * @return {void}
198
262
  */
199
- setRoot(root: Widget): void {
263
+ public setRoot(root: Widget): void {
200
264
  this.root = root;
201
265
  }
202
266
 
@@ -208,18 +272,48 @@ class WApplication implements IApplication {
208
272
  public hideLoading(): void {
209
273
  this.loading.setVisible(false);
210
274
  }
275
+
276
+ public goTo(path: string): void {
277
+ this.router.navigate(path);
278
+ }
211
279
  }
212
280
 
281
+ export const initApplicationConnections = () => {
282
+ if (!window.appConnections) {
283
+ window.appConnections = new Array<WUICallback>();
284
+ }
285
+ };
286
+ export const connectApplication = (cb: WUICallback) => {
287
+ initApplicationConnections();
288
+ window.appConnections.push(cb);
289
+ };
290
+
213
291
  export type ApplicationProps = {
214
292
  title: string;
215
293
  padding?: number | null;
216
294
  orientation?: OrientationTypes | null;
295
+ theme?: string | null;
217
296
  children: any;
297
+ onResize?: (args: any) => void;
298
+ onLoad?: (args: any) => void;
218
299
  };
219
300
 
220
301
  export const Application = (props: ApplicationProps) => {
302
+ if (props.onLoad) {
303
+ connectApplication({ event: "load", then: props.onLoad });
304
+ }
305
+
306
+ if (props.onResize) {
307
+ connectApplication({ event: "resize", then: props.onResize });
308
+ }
309
+
221
310
  return (
222
- <div title={props.title} w-padding={props.padding} w-orientation={props.orientation}>
311
+ <div
312
+ title={props.title}
313
+ w-padding={props.padding}
314
+ w-orientation={props.orientation}
315
+ w-theme={props.theme}
316
+ >
223
317
  {props.children}
224
318
  </div>
225
319
  );
@@ -234,11 +328,16 @@ export const Widgets = (props: WidgetsProps) => {
234
328
  };
235
329
 
236
330
  export type RoutesProps = {
331
+ hostId: string;
237
332
  children: any;
238
333
  };
239
334
 
240
335
  export const Routes = (props: RoutesProps) => {
241
- return <div w-routes>{props.children}</div>;
336
+ return (
337
+ <div w-routes w-host-id={props.hostId}>
338
+ {props.children}
339
+ </div>
340
+ );
242
341
  };
243
342
 
244
343
  export type RouteProps = {
@@ -246,7 +345,7 @@ export type RouteProps = {
246
345
  };
247
346
 
248
347
  export const Route = (props: RouteProps) => {
249
- return <a w-path href={props.src}></a>;
348
+ return <a w-route-path href={props.src}></a>;
250
349
  };
251
350
 
252
351
  export default WApplication;