slicejs-web-framework 1.0.32 → 1.0.33

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.
@@ -18,8 +18,11 @@ export default class Debugger extends HTMLElement {
18
18
  }
19
19
 
20
20
  async enableDebugMode() {
21
- const html = await slice.controller.fetchText('Debugger', 'html', 'Structural');
22
- const css = await slice.controller.fetchText('Debugger', 'css', 'Structural');
21
+ //const html = await slice.controller.fetchText('Debugger', 'html', 'Structural');
22
+ //const css = await slice.controller.fetchText('Debugger', 'css', 'Structural');
23
+
24
+ const html = productionOnlyHtml();
25
+ const css = productionOnlyCSS();
23
26
 
24
27
  this.innerHTML = html;
25
28
  slice.stylesManager.registerComponentStyles('Debugger', css);
@@ -640,4 +643,706 @@ export default class Debugger extends HTMLElement {
640
643
  }
641
644
  }
642
645
 
643
- customElements.define('slice-debugger', Debugger);
646
+ customElements.define('slice-debugger', Debugger);
647
+
648
+ function productionOnlyCSS(){
649
+ return `
650
+ #debugger-container {
651
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
652
+ display: none;
653
+ position: fixed;
654
+ top: 20px;
655
+ right: 20px;
656
+ width: 420px;
657
+ height: 85vh;
658
+ max-height: 85vh;
659
+ background: var(--primary-background-color);
660
+ border: 1px solid var(--medium-color);
661
+ border-radius: 12px;
662
+ box-shadow: 0 20px 40px rgba(var(--primary-color-rgb), 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
663
+ z-index: 10000;
664
+ overflow: hidden;
665
+ backdrop-filter: blur(10px);
666
+ }
667
+
668
+ #debugger-container.active {
669
+ display: flex;
670
+ flex-direction: column;
671
+ }
672
+
673
+ .debugger-header {
674
+ background: linear-gradient(135deg, var(--primary-color), var(--primary-color-shade));
675
+ color: var(--primary-color-contrast);
676
+ padding: 12px 16px;
677
+ border-radius: 12px 12px 0 0;
678
+ user-select: none;
679
+ cursor: grab;
680
+ }
681
+
682
+ .debugger-header:active {
683
+ cursor: grabbing;
684
+ }
685
+
686
+ .header-content {
687
+ display: flex;
688
+ justify-content: space-between;
689
+ align-items: center;
690
+ }
691
+
692
+ .component-info {
693
+ display: flex;
694
+ align-items: center;
695
+ gap: 10px;
696
+ }
697
+
698
+ .component-icon {
699
+ font-size: 20px;
700
+ opacity: 0.9;
701
+ }
702
+
703
+ .component-name {
704
+ font-size: 14px;
705
+ font-weight: 600;
706
+ margin-bottom: 2px;
707
+ }
708
+
709
+ .component-id {
710
+ font-size: 11px;
711
+ opacity: 0.8;
712
+ }
713
+
714
+ .header-actions {
715
+ display: flex;
716
+ gap: 8px;
717
+ }
718
+
719
+ .minimize-btn, #close-debugger {
720
+ background: rgba(255, 255, 255, 0.2);
721
+ border: none;
722
+ color: var(--primary-color-contrast);
723
+ width: 28px;
724
+ height: 28px;
725
+ border-radius: 6px;
726
+ cursor: pointer;
727
+ display: flex;
728
+ align-items: center;
729
+ justify-content: center;
730
+ font-size: 16px;
731
+ font-weight: bold;
732
+ transition: background 0.2s ease;
733
+ }
734
+
735
+ .minimize-btn:hover, #close-debugger:hover {
736
+ background: rgba(255, 255, 255, 0.3);
737
+ }
738
+
739
+ .debugger-content {
740
+ flex: 1;
741
+ display: flex;
742
+ flex-direction: column;
743
+ overflow: hidden;
744
+ }
745
+
746
+ .tabs-container {
747
+ border-bottom: 1px solid var(--medium-color);
748
+ }
749
+
750
+ .tab-nav {
751
+ display: flex;
752
+ background: var(--tertiary-background-color);
753
+ }
754
+
755
+ .tab-btn {
756
+ flex: 1;
757
+ padding: 10px 14px;
758
+ border: none;
759
+ background: transparent;
760
+ color: var(--font-secondary-color);
761
+ font-size: 12px;
762
+ font-weight: 500;
763
+ cursor: pointer;
764
+ transition: all 0.2s ease;
765
+ border-bottom: 2px solid transparent;
766
+ }
767
+
768
+ .tab-btn:hover {
769
+ background: var(--secondary-background-color);
770
+ color: var(--font-primary-color);
771
+ }
772
+
773
+ .tab-btn.active {
774
+ background: var(--primary-background-color);
775
+ color: var(--primary-color);
776
+ border-bottom-color: var(--primary-color);
777
+ font-weight: 600;
778
+ }
779
+
780
+ .tab-content {
781
+ flex: 1;
782
+ overflow: hidden;
783
+ height: calc(85vh - 100px);
784
+ }
785
+
786
+ .tab-pane {
787
+ display: none;
788
+ height: 100%;
789
+ overflow-y: auto;
790
+ overflow-x: hidden;
791
+ padding: 16px;
792
+ }
793
+
794
+ .tab-pane.active {
795
+ display: block;
796
+ }
797
+
798
+ .tab-pane::-webkit-scrollbar {
799
+ width: 4px;
800
+ }
801
+
802
+ .tab-pane::-webkit-scrollbar-track {
803
+ background: var(--tertiary-background-color);
804
+ border-radius: 2px;
805
+ }
806
+
807
+ .tab-pane::-webkit-scrollbar-thumb {
808
+ background: var(--medium-color);
809
+ border-radius: 2px;
810
+ }
811
+
812
+ .tab-pane::-webkit-scrollbar-thumb:hover {
813
+ background: var(--primary-color);
814
+ }
815
+
816
+ .props-container {
817
+ display: flex;
818
+ flex-direction: column;
819
+ gap: 12px;
820
+ margin-bottom: 16px;
821
+ }
822
+
823
+ .props-actions {
824
+ border-top: 1px solid var(--medium-color);
825
+ padding-top: 16px;
826
+ margin-top: 8px;
827
+ }
828
+
829
+ .actions-note {
830
+ margin-top: 12px;
831
+ padding: 8px 12px;
832
+ background: var(--tertiary-background-color);
833
+ border-radius: 6px;
834
+ border: 1px solid var(--medium-color);
835
+ }
836
+
837
+ .actions-note small {
838
+ color: var(--font-secondary-color);
839
+ font-size: 11px;
840
+ display: flex;
841
+ align-items: center;
842
+ gap: 6px;
843
+ }
844
+
845
+ .props-section {
846
+ background: var(--tertiary-background-color);
847
+ border: 1px solid var(--medium-color);
848
+ border-radius: 8px;
849
+ padding: 12px;
850
+ }
851
+
852
+ .section-title {
853
+ font-size: 12px;
854
+ font-weight: 600;
855
+ color: var(--font-primary-color);
856
+ margin-bottom: 12px;
857
+ display: flex;
858
+ align-items: center;
859
+ gap: 6px;
860
+ }
861
+
862
+ .prop-item {
863
+ display: flex;
864
+ flex-direction: column;
865
+ gap: 6px;
866
+ padding: 12px;
867
+ background: var(--primary-background-color);
868
+ border: 1px solid var(--medium-color);
869
+ border-radius: 6px;
870
+ margin-bottom: 8px;
871
+ transition: border-color 0.2s ease;
872
+ }
873
+
874
+ .prop-item:hover {
875
+ border-color: var(--primary-color);
876
+ }
877
+
878
+ .prop-header {
879
+ display: flex;
880
+ justify-content: space-between;
881
+ align-items: center;
882
+ }
883
+
884
+ .prop-name {
885
+ font-size: 13px;
886
+ font-weight: 600;
887
+ color: var(--font-primary-color);
888
+ }
889
+
890
+ .prop-name.required::after {
891
+ content: " *";
892
+ color: var(--danger-color);
893
+ }
894
+
895
+ .prop-meta {
896
+ display: flex;
897
+ align-items: center;
898
+ gap: 8px;
899
+ }
900
+
901
+ .prop-type {
902
+ font-size: 11px;
903
+ padding: 2px 6px;
904
+ background: var(--secondary-color);
905
+ color: var(--secondary-color-contrast);
906
+ border-radius: 4px;
907
+ font-family: monospace;
908
+ font-weight: 500;
909
+ }
910
+
911
+ .prop-status {
912
+ font-size: 12px;
913
+ font-weight: 500;
914
+ }
915
+
916
+ .status-used {
917
+ color: var(--success-color);
918
+ }
919
+
920
+ .status-missing {
921
+ color: var(--danger-color);
922
+ }
923
+
924
+ .status-optional {
925
+ color: var(--medium-color);
926
+ }
927
+
928
+ .prop-input {
929
+ margin-top: 8px;
930
+ }
931
+
932
+ .input-group {
933
+ position: relative;
934
+ }
935
+
936
+ .prop-control {
937
+ width: 100%;
938
+ padding: 8px 32px 8px 10px;
939
+ border: 1px solid var(--medium-color);
940
+ border-radius: 6px;
941
+ background: var(--primary-background-color);
942
+ color: var(--font-primary-color);
943
+ font-size: 13px;
944
+ transition: border-color 0.2s ease, box-shadow 0.2s ease;
945
+ font-family: monospace;
946
+ }
947
+
948
+ .prop-control:focus {
949
+ outline: none;
950
+ border-color: var(--primary-color);
951
+ box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
952
+ }
953
+
954
+ .prop-control:disabled {
955
+ background: var(--disabled-color);
956
+ color: var(--font-secondary-color);
957
+ cursor: not-allowed;
958
+ }
959
+
960
+ .prop-control[readonly] {
961
+ background: var(--tertiary-background-color);
962
+ cursor: pointer;
963
+ }
964
+
965
+ .prop-control[readonly]:focus {
966
+ border-color: var(--accent-color);
967
+ box-shadow: 0 0 0 3px rgba(var(--accent-color), 0.1);
968
+ }
969
+
970
+ /* Estilos específicos para checkboxes */
971
+ .prop-control[type="checkbox"] {
972
+ width: auto;
973
+ padding: 0;
974
+ margin: 0;
975
+ cursor: pointer;
976
+ }
977
+
978
+ .edit-btn {
979
+ position: absolute;
980
+ right: 4px;
981
+ top: 50%;
982
+ transform: translateY(-50%);
983
+ background: var(--accent-color);
984
+ border: none;
985
+ color: white;
986
+ width: 24px;
987
+ height: 24px;
988
+ border-radius: 4px;
989
+ cursor: pointer;
990
+ font-size: 12px;
991
+ display: flex;
992
+ align-items: center;
993
+ justify-content: center;
994
+ transition: background 0.2s ease;
995
+ }
996
+
997
+ .edit-btn:hover {
998
+ background: var(--primary-color);
999
+ }
1000
+
1001
+ .default-value {
1002
+ font-size: 11px;
1003
+ color: var(--font-secondary-color);
1004
+ font-style: italic;
1005
+ margin-top: 4px;
1006
+ }
1007
+
1008
+ .info-list {
1009
+ display: flex;
1010
+ flex-direction: column;
1011
+ gap: 12px;
1012
+ }
1013
+
1014
+ .info-item {
1015
+ display: flex;
1016
+ justify-content: space-between;
1017
+ padding: 12px;
1018
+ background: var(--tertiary-background-color);
1019
+ border-radius: 6px;
1020
+ border: 1px solid var(--medium-color);
1021
+ }
1022
+
1023
+ .info-label {
1024
+ font-weight: 600;
1025
+ color: var(--font-primary-color);
1026
+ font-size: 13px;
1027
+ }
1028
+
1029
+ .info-value {
1030
+ color: var(--font-secondary-color);
1031
+ font-family: monospace;
1032
+ font-size: 12px;
1033
+ }
1034
+
1035
+ .actions-container {
1036
+ display: flex;
1037
+ flex-direction: column;
1038
+ gap: 16px;
1039
+ }
1040
+
1041
+ .action-buttons {
1042
+ display: flex;
1043
+ flex-direction: column;
1044
+ gap: 8px;
1045
+ }
1046
+
1047
+ .action-btn {
1048
+ padding: 12px 16px;
1049
+ border: none;
1050
+ border-radius: 6px;
1051
+ font-size: 13px;
1052
+ font-weight: 500;
1053
+ cursor: pointer;
1054
+ transition: all 0.2s ease;
1055
+ display: flex;
1056
+ align-items: center;
1057
+ justify-content: center;
1058
+ gap: 8px;
1059
+ }
1060
+
1061
+ .action-btn.primary {
1062
+ background: var(--primary-color);
1063
+ color: var(--primary-color-contrast);
1064
+ }
1065
+
1066
+ .action-btn.primary:hover {
1067
+ background: var(--primary-color-shade);
1068
+ }
1069
+
1070
+ .action-btn.secondary {
1071
+ background: var(--secondary-color);
1072
+ color: var(--secondary-color-contrast);
1073
+ }
1074
+
1075
+ .action-btn.secondary:hover {
1076
+ opacity: 0.9;
1077
+ }
1078
+
1079
+ .action-btn.tertiary {
1080
+ background: var(--tertiary-background-color);
1081
+ color: var(--font-primary-color);
1082
+ border: 1px solid var(--medium-color);
1083
+ }
1084
+
1085
+ .action-btn.tertiary:hover {
1086
+ background: var(--secondary-background-color);
1087
+ }
1088
+
1089
+ /* Modal Styles */
1090
+ .editor-modal {
1091
+ display: none;
1092
+ position: fixed;
1093
+ top: 0;
1094
+ left: 0;
1095
+ width: 100%;
1096
+ height: 100%;
1097
+ background: rgba(0, 0, 0, 0.6);
1098
+ z-index: 20000;
1099
+ backdrop-filter: blur(4px);
1100
+ }
1101
+
1102
+ .editor-modal.active {
1103
+ display: flex;
1104
+ align-items: center;
1105
+ justify-content: center;
1106
+ }
1107
+
1108
+ .modal-content {
1109
+ background: var(--primary-background-color);
1110
+ border-radius: 12px;
1111
+ width: 90%;
1112
+ max-width: 600px;
1113
+ max-height: 80%;
1114
+ display: flex;
1115
+ flex-direction: column;
1116
+ box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
1117
+ border: 1px solid var(--medium-color);
1118
+ }
1119
+
1120
+ .modal-header {
1121
+ padding: 16px 20px;
1122
+ background: var(--tertiary-background-color);
1123
+ border-radius: 12px 12px 0 0;
1124
+ border-bottom: 1px solid var(--medium-color);
1125
+ display: flex;
1126
+ justify-content: space-between;
1127
+ align-items: center;
1128
+ }
1129
+
1130
+ .modal-header h3 {
1131
+ margin: 0;
1132
+ font-size: 16px;
1133
+ font-weight: 600;
1134
+ color: var(--font-primary-color);
1135
+ }
1136
+
1137
+ .modal-close {
1138
+ background: none;
1139
+ border: none;
1140
+ font-size: 20px;
1141
+ color: var(--font-secondary-color);
1142
+ cursor: pointer;
1143
+ width: 32px;
1144
+ height: 32px;
1145
+ border-radius: 6px;
1146
+ display: flex;
1147
+ align-items: center;
1148
+ justify-content: center;
1149
+ transition: background 0.2s ease;
1150
+ }
1151
+
1152
+ .modal-close:hover {
1153
+ background: var(--secondary-background-color);
1154
+ }
1155
+
1156
+ .modal-body {
1157
+ flex: 1;
1158
+ padding: 20px;
1159
+ display: flex;
1160
+ flex-direction: column;
1161
+ gap: 16px;
1162
+ overflow: hidden;
1163
+ }
1164
+
1165
+ .editor-type-selector {
1166
+ display: flex;
1167
+ gap: 4px;
1168
+ background: var(--tertiary-background-color);
1169
+ padding: 4px;
1170
+ border-radius: 6px;
1171
+ }
1172
+
1173
+ .type-btn {
1174
+ flex: 1;
1175
+ padding: 8px 12px;
1176
+ border: none;
1177
+ background: transparent;
1178
+ color: var(--font-secondary-color);
1179
+ font-size: 12px;
1180
+ font-weight: 500;
1181
+ cursor: pointer;
1182
+ border-radius: 4px;
1183
+ transition: all 0.2s ease;
1184
+ }
1185
+
1186
+ .type-btn.active {
1187
+ background: var(--primary-color);
1188
+ color: var(--primary-color-contrast);
1189
+ }
1190
+
1191
+ .editor-container {
1192
+ flex: 1;
1193
+ position: relative;
1194
+ min-height: 200px;
1195
+ }
1196
+
1197
+ #property-editor {
1198
+ width: 100%;
1199
+ height: 100%;
1200
+ border: 1px solid var(--medium-color);
1201
+ border-radius: 6px;
1202
+ padding: 12px;
1203
+ background: var(--primary-background-color);
1204
+ color: var(--font-primary-color);
1205
+ font-family: 'Monaco', 'Consolas', monospace;
1206
+ font-size: 13px;
1207
+ line-height: 1.5;
1208
+ resize: none;
1209
+ outline: none;
1210
+ min-height: 200px;
1211
+ }
1212
+
1213
+ #property-editor:focus {
1214
+ border-color: var(--primary-color);
1215
+ box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
1216
+ }
1217
+
1218
+ .validation-message {
1219
+ font-size: 12px;
1220
+ color: var(--danger-color);
1221
+ min-height: 18px;
1222
+ display: flex;
1223
+ align-items: center;
1224
+ gap: 6px;
1225
+ }
1226
+
1227
+ .modal-actions {
1228
+ padding: 16px 20px;
1229
+ background: var(--tertiary-background-color);
1230
+ border-radius: 0 0 12px 12px;
1231
+ border-top: 1px solid var(--medium-color);
1232
+ display: flex;
1233
+ gap: 12px;
1234
+ justify-content: flex-end;
1235
+ }
1236
+
1237
+ .modal-btn {
1238
+ padding: 10px 20px;
1239
+ border: none;
1240
+ border-radius: 6px;
1241
+ font-size: 13px;
1242
+ font-weight: 500;
1243
+ cursor: pointer;
1244
+ transition: all 0.2s ease;
1245
+ }
1246
+
1247
+ .modal-btn.cancel {
1248
+ background: var(--tertiary-background-color);
1249
+ color: var(--font-primary-color);
1250
+ border: 1px solid var(--medium-color);
1251
+ }
1252
+
1253
+ .modal-btn.cancel:hover {
1254
+ background: var(--secondary-background-color);
1255
+ }
1256
+
1257
+ .modal-btn.save {
1258
+ background: var(--success-color);
1259
+ color: var(--success-contrast);
1260
+ }
1261
+
1262
+ .modal-btn.save:hover {
1263
+ opacity: 0.9;
1264
+ }
1265
+
1266
+ .modal-btn.save:disabled {
1267
+ background: var(--disabled-color);
1268
+ cursor: not-allowed;
1269
+ }
1270
+ `
1271
+ }
1272
+
1273
+ function productionOnlyHtml(){
1274
+ return `
1275
+ <div id="debugger-container">
1276
+ <div class="debugger-header">
1277
+ <div class="header-content">
1278
+ <div class="component-info">
1279
+ <div class="component-icon">🔍</div>
1280
+ <div class="component-details">
1281
+ <div class="component-name">Component Inspector</div>
1282
+ <div class="component-id">Ready to debug</div>
1283
+ </div>
1284
+ </div>
1285
+ <div class="header-actions">
1286
+ <button class="minimize-btn" title="Minimize">−</button>
1287
+ <button id="close-debugger" title="Close">×</button>
1288
+ </div>
1289
+ </div>
1290
+ </div>
1291
+
1292
+ <div class="debugger-content">
1293
+ <div class="tabs-container">
1294
+ <div class="tab-nav">
1295
+ <button class="tab-btn active" data-tab="props">📋 Props</button>
1296
+ <button class="tab-btn" data-tab="info">ℹ️ Info</button>
1297
+ </div>
1298
+ </div>
1299
+
1300
+ <div class="tab-content">
1301
+ <div class="tab-pane active" id="props-tab">
1302
+ <div class="props-container"></div>
1303
+ <div class="props-actions">
1304
+ <div class="action-buttons">
1305
+ <button class="action-btn primary" id="apply-changes">✅ Apply Changes</button>
1306
+ <button class="action-btn secondary" id="reset-values">🔄 Reset Values</button>
1307
+ </div>
1308
+ <div class="actions-note">
1309
+ <small>💡 Press Enter on any input to apply changes automatically</small>
1310
+ </div>
1311
+ </div>
1312
+ </div>
1313
+
1314
+ <div class="tab-pane" id="info-tab">
1315
+ <div class="info-container">
1316
+ <div class="info-list"></div>
1317
+ </div>
1318
+ </div>
1319
+ </div>
1320
+ </div>
1321
+
1322
+ <!-- Modal para editar objetos/funciones -->
1323
+ <div class="editor-modal" id="editor-modal">
1324
+ <div class="modal-content">
1325
+ <div class="modal-header">
1326
+ <h3 id="modal-title">Edit Property</h3>
1327
+ <button class="modal-close" id="modal-close">×</button>
1328
+ </div>
1329
+ <div class="modal-body">
1330
+ <div class="editor-type-selector">
1331
+ <button class="type-btn active" data-type="json">📋 JSON</button>
1332
+ <button class="type-btn" data-type="function">⚡ Function</button>
1333
+ </div>
1334
+ <div class="editor-container">
1335
+ <textarea id="property-editor" spellcheck="false"></textarea>
1336
+ </div>
1337
+ <div class="editor-footer">
1338
+ <div class="validation-message"></div>
1339
+ </div>
1340
+ </div>
1341
+ <div class="modal-actions">
1342
+ <button class="modal-btn cancel" id="modal-cancel">Cancel</button>
1343
+ <button class="modal-btn save" id="modal-save">Save Changes</button>
1344
+ </div>
1345
+ </div>
1346
+ </div>
1347
+ </div>`
1348
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slicejs-web-framework",
3
- "version": "1.0.32",
3
+ "version": "1.0.33",
4
4
  "description": "",
5
5
  "engines": {
6
6
  "node": ">=20"
@@ -1,196 +1,196 @@
1
- export default class HomePage extends HTMLElement {
2
- constructor(props) {
3
- super();
4
- slice.attachTemplate(this);
5
-
6
- this.$examplesContainer = this.querySelector('.examples-container');
7
-
8
- slice.controller.setComponentProps(this, props);
9
- this.debuggerProps = [];
10
- }
11
-
12
- async init() {
13
- // Crear la barra de navegación
14
- const navbar = await slice.build('Navbar', {
15
- position: 'fixed',
16
- logo: {
17
- src: '/images/Slice.js-logo.png',
18
- path: '/',
19
- },
20
- items: [
21
- { text: 'Home', path: '/' },
22
- { text: 'Playground', path: '/Playground' },
23
-
24
- ],
25
- buttons: [
26
- {
27
- value: 'Change Theme',
28
- onClickCallback: async () => {
29
- const currentTheme = slice.stylesManager.themeManager.currentTheme;
30
- if (currentTheme === 'Slice') {
31
- await slice.setTheme('Light');
32
- } else if (currentTheme === 'Light') {
33
- await slice.setTheme('Dark');
34
- } else {
35
- await slice.setTheme('Slice');
36
- }
37
- },
38
- },
39
- ],
40
- });
41
-
42
- // Crear botones para la sección de llamada a la acción
43
- const docsButton = await slice.build('Button', {
44
- value: 'Documentation',
45
- onClickCallback: () => //redirect to https://slice-js-docs.vercel.app/Documentation
46
- window.open('https://slice-js-docs.vercel.app/Documentation', '_blank'),
47
- customColor: {
48
- button: 'var(--primary-color)',
49
- label: 'var(--primary-color-contrast)'
50
- }
51
- });
52
-
53
- const componentsButton = await slice.build('Button', {
54
- value: 'Components Library',
55
- onClickCallback: () => window.open('https://slice-js-docs.vercel.app/Documentation/Visual', '_blank'),
56
- customColor: {
57
- button: 'var(--secondary-color)',
58
- label: 'var(--secondary-color-contrast)'
59
- }
60
- });
61
-
62
- // Añadir botones a la sección CTA
63
- this.querySelector('.cta-buttons').appendChild(docsButton);
64
- this.querySelector('.cta-buttons').appendChild(componentsButton);
65
-
66
- // Crear features section con un enfoque diferente (sin usar Cards)
67
- await this.createFeatures();
68
-
69
- // Crear ejemplos de componentes
70
- await this.createComponentExamples();
71
-
72
- // Configurar la sección de código de inicio
73
- await this.setupGettingStartedSection();
74
-
75
- // Añadir la barra de navegación al inicio del componente
76
- this.insertBefore(navbar, this.firstChild);
77
- }
78
-
79
- async createFeatures() {
80
- // Definir características
81
- const features = [
82
- {
83
- title: 'Component-Based',
84
- description: 'Build your app using modular, reusable components following web standards.'
85
- },
86
- {
87
- title: 'Zero Dependencies',
88
- description: 'Built with vanilla JavaScript. No external libraries required.'
89
- },
90
- {
91
- title: 'Easy Routing',
92
- description: 'Simple and powerful routing system for single page applications.'
93
- },
94
- {
95
- title: 'Theme System',
96
- description: 'Built-in theme support with easy customization through CSS variables.'
97
- },
98
- {
99
- title: 'Developer Tools',
100
- description: 'Integrated debugging and logging for faster development.'
101
- },
102
- {
103
- title: 'Performance Focused',
104
- description: 'Lightweight and optimized for fast loading and execution.'
105
- }
106
- ];
107
-
108
- const featureGrid = this.querySelector('.feature-grid');
109
-
110
- // Crear y añadir cada feature como un elemento HTML simple
111
- for (const feature of features) {
112
- const featureElement = document.createElement('div');
113
- featureElement.classList.add('feature-item');
114
-
115
- const featureTitle = document.createElement('h3');
116
- featureTitle.textContent = feature.title;
117
- featureTitle.classList.add('feature-title');
118
-
119
- const featureDescription = document.createElement('p');
120
- featureDescription.textContent = feature.description;
121
- featureDescription.classList.add('feature-description');
122
-
123
- featureElement.appendChild(featureTitle);
124
- featureElement.appendChild(featureDescription);
125
-
126
- featureGrid.appendChild(featureElement);
127
- }
128
- }
129
-
130
- async createComponentExamples() {
131
- // Crear ejemplos para demostrar componentes
132
- const inputExample = await slice.build('Input', {
133
- placeholder: 'Try typing here...',
134
- type: 'text'
135
- });
136
-
137
- const switchExample = await slice.build('Switch', {
138
- label: 'Toggle me',
139
- checked: true
140
- });
141
-
142
- const checkboxExample = await slice.build('Checkbox', {
143
- label: 'Check me',
144
- labelPlacement: 'right'
145
- });
146
-
147
- const detailsExample = await slice.build('Details', {
148
- title: 'Click to expand',
149
- text: 'This is a collapsible details component that can contain any content.'
150
- });
151
-
152
- // Crear sección para cada ejemplo
153
- const exampleSections = [
154
- { title: 'Input Component', component: inputExample },
155
- { title: 'Switch Component', component: switchExample },
156
- { title: 'Checkbox Component', component: checkboxExample },
157
- { title: 'Details Component', component: detailsExample }
158
- ];
159
-
160
- // Añadir cada ejemplo a la sección de ejemplos
161
- for (const section of exampleSections) {
162
- const container = document.createElement('div');
163
- container.classList.add('example-item');
164
-
165
- const title = document.createElement('h3');
166
- title.textContent = section.title;
167
-
168
- container.appendChild(title);
169
- container.appendChild(section.component);
170
-
171
- this.$examplesContainer.appendChild(container);
172
- }
173
- }
174
-
175
- async setupGettingStartedSection() {
176
- // Opcionalmente podríamos mejorar esta sección usando el CodeVisualizer component
177
- // en lugar del código HTML estático en el template
178
- const codeVisualizer = await slice.build('CodeVisualizer', {
179
- value: `// Initialize a new Slice.js project
180
- npm run slice:init
181
-
182
- // Create a new component
183
- npm run slice:create
184
-
185
- // Start your application
186
- npm run slice:start`,
187
- language: 'bash'
188
- });
189
-
190
- const codeSample = this.querySelector('.code-sample');
191
- codeSample.innerHTML = ''; // Clear the static code sample
192
- codeSample.appendChild(codeVisualizer);
193
- }
194
- }
195
-
1
+ export default class HomePage extends HTMLElement {
2
+ constructor(props) {
3
+ super();
4
+ slice.attachTemplate(this);
5
+
6
+ this.$examplesContainer = this.querySelector('.examples-container');
7
+
8
+ slice.controller.setComponentProps(this, props);
9
+ this.debuggerProps = [];
10
+ }
11
+
12
+ async init() {
13
+ // Crear la barra de navegación
14
+ const navbar = await slice.build('Navbar', {
15
+ position: 'fixed',
16
+ logo: {
17
+ src: '/images/Slice.js-logo.png',
18
+ path: '/',
19
+ },
20
+ items: [
21
+ { text: 'Home', path: '/' },
22
+ { text: 'Playground', path: '/Playground' },
23
+
24
+ ],
25
+ buttons: [
26
+ {
27
+ value: 'Change Theme',
28
+ onClickCallback: async () => {
29
+ const currentTheme = slice.stylesManager.themeManager.currentTheme;
30
+ if (currentTheme === 'Slice') {
31
+ await slice.setTheme('Light');
32
+ } else if (currentTheme === 'Light') {
33
+ await slice.setTheme('Dark');
34
+ } else {
35
+ await slice.setTheme('Slice');
36
+ }
37
+ },
38
+ },
39
+ ],
40
+ });
41
+
42
+ // Crear botones para la sección de llamada a la acción
43
+ const docsButton = await slice.build('Button', {
44
+ value: 'Documentation',
45
+ onClickCallback: () => //redirect to https://slice-js-docs.vercel.app/Documentation
46
+ window.open('https://slice-js-docs.vercel.app/Documentation', '_blank'),
47
+ customColor: {
48
+ button: 'var(--primary-color)',
49
+ label: 'var(--primary-color-contrast)'
50
+ }
51
+ });
52
+
53
+ const componentsButton = await slice.build('Button', {
54
+ value: 'Components Library',
55
+ onClickCallback: () => window.open('https://slice-js-docs.vercel.app/Documentation/Visual', '_blank'),
56
+ customColor: {
57
+ button: 'var(--secondary-color)',
58
+ label: 'var(--secondary-color-contrast)'
59
+ }
60
+ });
61
+
62
+ // Añadir botones a la sección CTA
63
+ this.querySelector('.cta-buttons').appendChild(docsButton);
64
+ this.querySelector('.cta-buttons').appendChild(componentsButton);
65
+
66
+ // Crear features section con un enfoque diferente (sin usar Cards)
67
+ await this.createFeatures();
68
+
69
+ // Crear ejemplos de componentes
70
+ await this.createComponentExamples();
71
+
72
+ // Configurar la sección de código de inicio
73
+ await this.setupGettingStartedSection();
74
+
75
+ // Añadir la barra de navegación al inicio del componente
76
+ this.insertBefore(navbar, this.firstChild);
77
+ }
78
+
79
+ async createFeatures() {
80
+ // Definir características
81
+ const features = [
82
+ {
83
+ title: 'Component-Based',
84
+ description: 'Build your app using modular, reusable components following web standards.'
85
+ },
86
+ {
87
+ title: 'Zero Dependencies',
88
+ description: 'Built with vanilla JavaScript. No external libraries required.'
89
+ },
90
+ {
91
+ title: 'Easy Routing',
92
+ description: 'Simple and powerful routing system for single page applications.'
93
+ },
94
+ {
95
+ title: 'Theme System',
96
+ description: 'Built-in theme support with easy customization through CSS variables.'
97
+ },
98
+ {
99
+ title: 'Developer Tools',
100
+ description: 'Integrated debugging and logging for faster development.'
101
+ },
102
+ {
103
+ title: 'Performance Focused',
104
+ description: 'Lightweight and optimized for fast loading and execution.'
105
+ }
106
+ ];
107
+
108
+ const featureGrid = this.querySelector('.feature-grid');
109
+
110
+ // Crear y añadir cada feature como un elemento HTML simple
111
+ for (const feature of features) {
112
+ const featureElement = document.createElement('div');
113
+ featureElement.classList.add('feature-item');
114
+
115
+ const featureTitle = document.createElement('h3');
116
+ featureTitle.textContent = feature.title;
117
+ featureTitle.classList.add('feature-title');
118
+
119
+ const featureDescription = document.createElement('p');
120
+ featureDescription.textContent = feature.description;
121
+ featureDescription.classList.add('feature-description');
122
+
123
+ featureElement.appendChild(featureTitle);
124
+ featureElement.appendChild(featureDescription);
125
+
126
+ featureGrid.appendChild(featureElement);
127
+ }
128
+ }
129
+
130
+ async createComponentExamples() {
131
+ // Crear ejemplos para demostrar componentes
132
+ const inputExample = await slice.build('Input', {
133
+ placeholder: 'Try typing here...',
134
+ type: 'text'
135
+ });
136
+
137
+ const switchExample = await slice.build('Switch', {
138
+ label: 'Toggle me',
139
+ checked: true
140
+ });
141
+
142
+ const checkboxExample = await slice.build('Checkbox', {
143
+ label: 'Check me',
144
+ labelPlacement: 'right'
145
+ });
146
+
147
+ const detailsExample = await slice.build('Details', {
148
+ title: 'Click to expand',
149
+ text: 'This is a collapsible details component that can contain any content.'
150
+ });
151
+
152
+ // Crear sección para cada ejemplo
153
+ const exampleSections = [
154
+ { title: 'Input Component', component: inputExample },
155
+ { title: 'Switch Component', component: switchExample },
156
+ { title: 'Checkbox Component', component: checkboxExample },
157
+ { title: 'Details Component', component: detailsExample }
158
+ ];
159
+
160
+ // Añadir cada ejemplo a la sección de ejemplos
161
+ for (const section of exampleSections) {
162
+ const container = document.createElement('div');
163
+ container.classList.add('example-item');
164
+
165
+ const title = document.createElement('h3');
166
+ title.textContent = section.title;
167
+
168
+ container.appendChild(title);
169
+ container.appendChild(section.component);
170
+
171
+ this.$examplesContainer.appendChild(container);
172
+ }
173
+ }
174
+
175
+ async setupGettingStartedSection() {
176
+ // Opcionalmente podríamos mejorar esta sección usando el CodeVisualizer component
177
+ // en lugar del código HTML estático en el template
178
+ const codeVisualizer = await slice.build('CodeVisualizer', {
179
+ value: `// Initialize a new Slice.js project
180
+ npm run slice:init
181
+
182
+ // Create a new component
183
+ npm run slice:create
184
+
185
+ // Start your application
186
+ npm run slice:start`,
187
+ language: 'bash'
188
+ });
189
+
190
+ const codeSample = this.querySelector('.code-sample');
191
+ codeSample.innerHTML = ''; // Clear the static code sample
192
+ codeSample.appendChild(codeVisualizer);
193
+ }
194
+ }
195
+
196
196
  customElements.define('slice-home-page', HomePage);
@@ -1,28 +1,28 @@
1
- const components = {
2
- "HomePage": "AppComponents",
3
- "Playground": "AppComponents",
4
- "Button": "Visual",
5
- "Card": "Visual",
6
- "Checkbox": "Visual",
7
- "CodeVisualizer": "Visual",
8
- "Details": "Visual",
9
- "DropDown": "Visual",
10
- "Grid": "Visual",
11
- "Icon": "Visual",
12
- "Input": "Visual",
13
- "Layout": "Visual",
14
- "Loading": "Visual",
15
- "MultiRoute": "Visual",
16
- "Navbar": "Visual",
17
- "NotFound": "Visual",
18
- "Route": "Visual",
19
- "Select": "Visual",
20
- "Switch": "Visual",
21
- "TreeItem": "Visual",
22
- "TreeView": "Visual",
23
- "FetchManager": "Service",
24
- "IndexedDbManager": "Service",
25
- "Link": "Service",
26
- "LocalStorageManager": "Service",
27
- "Translator": "Service"
1
+ const components = {
2
+ "HomePage": "AppComponents",
3
+ "Playground": "AppComponents",
4
+ "Button": "Visual",
5
+ "Card": "Visual",
6
+ "Checkbox": "Visual",
7
+ "CodeVisualizer": "Visual",
8
+ "Details": "Visual",
9
+ "DropDown": "Visual",
10
+ "Grid": "Visual",
11
+ "Icon": "Visual",
12
+ "Input": "Visual",
13
+ "Layout": "Visual",
14
+ "Loading": "Visual",
15
+ "MultiRoute": "Visual",
16
+ "Navbar": "Visual",
17
+ "NotFound": "Visual",
18
+ "Route": "Visual",
19
+ "Select": "Visual",
20
+ "Switch": "Visual",
21
+ "TreeItem": "Visual",
22
+ "TreeView": "Visual",
23
+ "FetchManager": "Service",
24
+ "IndexedDbManager": "Service",
25
+ "Link": "Service",
26
+ "LocalStorageManager": "Service",
27
+ "Translator": "Service"
28
28
  }; export default components;