ezfw-core 1.0.0

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 (154) hide show
  1. package/components/EzBaseComponent.ts +648 -0
  2. package/components/EzComponent.ts +89 -0
  3. package/components/EzInput.module.scss +183 -0
  4. package/components/EzInput.ts +104 -0
  5. package/components/EzLabel.ts +22 -0
  6. package/components/EzOutlet.ts +181 -0
  7. package/components/HtmlWrapper.ts +305 -0
  8. package/components/avatar/EzAvatar.module.scss +200 -0
  9. package/components/avatar/EzAvatar.ts +130 -0
  10. package/components/badge/EzBadge.module.scss +202 -0
  11. package/components/badge/EzBadge.ts +77 -0
  12. package/components/button/EzButton.module.scss +402 -0
  13. package/components/button/EzButton.ts +175 -0
  14. package/components/button/EzButtonGroup.ts +48 -0
  15. package/components/card/EzCard.module.scss +71 -0
  16. package/components/card/EzCard.ts +120 -0
  17. package/components/chart/EzBarChart.ts +47 -0
  18. package/components/chart/EzChart.module.scss +14 -0
  19. package/components/chart/EzChart.ts +279 -0
  20. package/components/chart/EzDoughnutChart.ts +47 -0
  21. package/components/chart/EzLineChart.ts +53 -0
  22. package/components/checkbox/EzCheckbox.module.scss +145 -0
  23. package/components/checkbox/EzCheckbox.ts +115 -0
  24. package/components/dataview/EzDataView.module.scss +115 -0
  25. package/components/dataview/EzDataView.ts +355 -0
  26. package/components/dataview/modes/EzDataViewCards.ts +322 -0
  27. package/components/dataview/modes/EzDataViewGrid.ts +76 -0
  28. package/components/datepicker/EzDatePicker.module.scss +348 -0
  29. package/components/datepicker/EzDatePicker.ts +519 -0
  30. package/components/dialog/EzDialog.module.scss +180 -0
  31. package/components/dropdown/EzDropdown.module.scss +107 -0
  32. package/components/dropdown/EzDropdown.ts +235 -0
  33. package/components/feed/EzActivityFeed.module.scss +90 -0
  34. package/components/feed/EzActivityFeed.ts +78 -0
  35. package/components/form/EzForm.ts +364 -0
  36. package/components/form/EzValidators.test.js +421 -0
  37. package/components/form/EzValidators.ts +202 -0
  38. package/components/grid/EzGrid.scss +88 -0
  39. package/components/grid/EzGrid.ts +1085 -0
  40. package/components/grid/EzGridContainer.ts +104 -0
  41. package/components/grid/body/EzGridBody.scss +283 -0
  42. package/components/grid/body/EzGridBody.ts +549 -0
  43. package/components/grid/body/EzGridCell.ts +211 -0
  44. package/components/grid/body/EzGridRow.ts +196 -0
  45. package/components/grid/filter/EzGridFilters.scss +78 -0
  46. package/components/grid/filter/EzGridFilters.ts +285 -0
  47. package/components/grid/footer/EzGridFooter.scss +136 -0
  48. package/components/grid/footer/EzGridFooter.ts +448 -0
  49. package/components/grid/header/EzGridHeader.scss +199 -0
  50. package/components/grid/header/EzGridHeader.ts +430 -0
  51. package/components/grid/query/EzGridQuery.ts +81 -0
  52. package/components/grid/state/EzGridColumns.ts +155 -0
  53. package/components/grid/state/EzGridController.ts +470 -0
  54. package/components/grid/state/EzGridLifecycle.ts +136 -0
  55. package/components/grid/state/EzGridNormalizers.test.js +273 -0
  56. package/components/grid/state/EzGridNormalizers.ts +162 -0
  57. package/components/grid/state/EzGridParts.ts +233 -0
  58. package/components/grid/state/EzGridPersistence.ts +140 -0
  59. package/components/grid/state/EzGridRemote.test.js +573 -0
  60. package/components/grid/state/EzGridRemote.ts +335 -0
  61. package/components/grid/state/EzGridSelection.ts +231 -0
  62. package/components/grid/state/EzGridSort.ts +286 -0
  63. package/components/grid/title/EzGridActionBar.ts +98 -0
  64. package/components/grid/title/EzGridTitle.ts +114 -0
  65. package/components/grid/title/EzGridTitleBar.scss +65 -0
  66. package/components/grid/title/EzGridTitleBar.ts +87 -0
  67. package/components/grid/types.ts +607 -0
  68. package/components/panel/EzPanel.module.scss +133 -0
  69. package/components/panel/EzPanel.ts +147 -0
  70. package/components/radio/EzRadio.module.scss +190 -0
  71. package/components/radio/EzRadio.ts +149 -0
  72. package/components/select/EzSelect.module.scss +153 -0
  73. package/components/select/EzSelect.ts +238 -0
  74. package/components/skeleton/EzSkeleton.module.scss +95 -0
  75. package/components/skeleton/EzSkeleton.ts +70 -0
  76. package/components/store/EzStore.ts +344 -0
  77. package/components/switch/EzSwitch.module.scss +164 -0
  78. package/components/switch/EzSwitch.ts +117 -0
  79. package/components/tabs/EzTabPanel.module.scss +181 -0
  80. package/components/tabs/EzTabPanel.ts +402 -0
  81. package/components/textarea/EzTextarea.module.scss +131 -0
  82. package/components/textarea/EzTextarea.ts +161 -0
  83. package/components/timepicker/EzTimePicker.module.scss +282 -0
  84. package/components/timepicker/EzTimePicker.ts +540 -0
  85. package/components/toast/EzToast.module.scss +291 -0
  86. package/components/tooltip/EzTooltip.module.scss +124 -0
  87. package/components/tooltip/EzTooltip.ts +153 -0
  88. package/core/EzComponentTypes.ts +693 -0
  89. package/core/EzError.ts +63 -0
  90. package/core/EzModel.ts +268 -0
  91. package/core/EzTypes.ts +328 -0
  92. package/core/eventBus.ts +284 -0
  93. package/core/ez.ts +617 -0
  94. package/core/loader.ts +725 -0
  95. package/core/renderer.ts +1010 -0
  96. package/core/router.ts +490 -0
  97. package/core/services.ts +124 -0
  98. package/core/state.ts +142 -0
  99. package/core/utils.ts +81 -0
  100. package/package.json +51 -0
  101. package/services/RouteUI.js +17 -0
  102. package/services/crypto.js +64 -0
  103. package/services/dialog.js +222 -0
  104. package/services/fetchApi.js +63 -0
  105. package/services/firebase.js +30 -0
  106. package/services/toast.js +214 -0
  107. package/template/doc/EzDocs.js +15 -0
  108. package/template/doc/EzDocs.module.scss +627 -0
  109. package/template/doc/EzDocsController.js +164 -0
  110. package/template/doc/data/activityfeed/EzActivityFeedDoc.js +42 -0
  111. package/template/doc/data/avatar/EzAvatarDoc.js +71 -0
  112. package/template/doc/data/badge/EzBadgeDoc.js +92 -0
  113. package/template/doc/data/button/EzButtonDoc.js +77 -0
  114. package/template/doc/data/buttongroup/EzButtonGroupDoc.js +102 -0
  115. package/template/doc/data/card/EzCardDoc.js +39 -0
  116. package/template/doc/data/chart/EzChartDoc.js +60 -0
  117. package/template/doc/data/checkbox/EzCheckboxDoc.js +67 -0
  118. package/template/doc/data/component/EzComponentDoc.js +34 -0
  119. package/template/doc/data/cssmodules/CSSModulesDoc.js +70 -0
  120. package/template/doc/data/datepicker/EzDatePickerDoc.js +126 -0
  121. package/template/doc/data/dialog/EzDialogDoc.js +217 -0
  122. package/template/doc/data/dropdown/EzDropdownDoc.js +178 -0
  123. package/template/doc/data/form/EzFormDoc.js +90 -0
  124. package/template/doc/data/grid/EzGridDoc.js +99 -0
  125. package/template/doc/data/input/EzInputDoc.js +92 -0
  126. package/template/doc/data/label/EzLabelDoc.js +40 -0
  127. package/template/doc/data/model/EzModelDoc.js +53 -0
  128. package/template/doc/data/outlet/EzOutletDoc.js +63 -0
  129. package/template/doc/data/panel/EzPanelDoc.js +214 -0
  130. package/template/doc/data/radio/EzRadioDoc.js +174 -0
  131. package/template/doc/data/router/EzRouterDoc.js +75 -0
  132. package/template/doc/data/select/EzSelectDoc.js +37 -0
  133. package/template/doc/data/skeleton/EzSkeletonDoc.js +149 -0
  134. package/template/doc/data/switch/EzSwitchDoc.js +82 -0
  135. package/template/doc/data/tabpanel/EzTabPanelDoc.js +44 -0
  136. package/template/doc/data/textarea/EzTextareaDoc.js +131 -0
  137. package/template/doc/data/timepicker/EzTimePickerDoc.js +107 -0
  138. package/template/doc/data/tooltip/EzTooltipDoc.js +193 -0
  139. package/template/doc/data/validators/EzValidatorsDoc.js +37 -0
  140. package/template/doc/sidebar/EzDocsSidebar.js +32 -0
  141. package/template/doc/sidebar/category/EzDocsCategory.js +33 -0
  142. package/template/doc/sidebar/item/EzDocsComponentItem.js +24 -0
  143. package/template/doc/viewer/EzDocsViewer.js +18 -0
  144. package/template/doc/viewer/codepanel/EzDocsCodePanel.js +51 -0
  145. package/template/doc/viewer/content/EzDocsContent.js +315 -0
  146. package/template/doc/viewer/header/EzDocsViewerHeader.js +46 -0
  147. package/template/doc/viewer/showcase/EzDocsShowcase.js +59 -0
  148. package/template/doc/viewer/showcase/EzDocsShowcaseSection.js +25 -0
  149. package/template/doc/viewer/showcase/EzDocsVariantItem.js +29 -0
  150. package/template/doc/welcome/EzDocsWelcome.js +48 -0
  151. package/themes/ez-theme.scss +179 -0
  152. package/themes/nature-fresh.scss +169 -0
  153. package/types/global.d.ts +21 -0
  154. package/utils/cssModules.js +81 -0
@@ -0,0 +1,24 @@
1
+ ez.define('EzDocsComponentItem', {
2
+ template(props) {
3
+ return {
4
+ eztype: 'li',
5
+ bind: {
6
+ cls: () => {
7
+ const ctrl = ez.getControllerSync('EzDocs');
8
+ const selected = ctrl.state.selectedComponent;
9
+ return selected === props.name
10
+ ? 'ez-docs-component-item active'
11
+ : 'ez-docs-component-item';
12
+ }
13
+ },
14
+ onClick: () => ez.go(`/admin/docs/${props.name}`),
15
+ items: [
16
+ {
17
+ eztype: 'EzLabel',
18
+ cls: 'ez-docs-component-name',
19
+ text: props.name
20
+ }
21
+ ]
22
+ };
23
+ }
24
+ });
@@ -0,0 +1,18 @@
1
+ ez.define('EzDocsViewer', {
2
+ template(props) {
3
+ const componentName = props.routeParams?.component;
4
+ const ctrl = ez.getControllerSync('EzDocs');
5
+ const info = ctrl.getComponentInfo(componentName);
6
+
7
+ ctrl.state.selectedVariant = null;
8
+
9
+ return {
10
+ eztype: 'EzComponent',
11
+ cls: 'ez-docs-viewer',
12
+ items: [
13
+ { eztype: 'EzDocsViewerHeader', props: { componentName, info } },
14
+ { eztype: `${componentName}Doc` }
15
+ ]
16
+ };
17
+ }
18
+ });
@@ -0,0 +1,51 @@
1
+ ez.define('EzDocsCodePanel', {
2
+ template() {
3
+ const ctrl = ez.getControllerSync('EzDocs');
4
+
5
+ return {
6
+ eztype: 'EzComponent',
7
+ cls: 'ez-docs-code-panel',
8
+ items: [
9
+ {
10
+ eztype: 'EzComponent',
11
+ cls: 'ez-docs-code-panel-header',
12
+ items: [
13
+ { eztype: 'i', cls: ['fa-solid', 'fa-code'] },
14
+ { eztype: 'EzLabel', text: 'Code', flex: 1 },
15
+ {
16
+ eztype: 'EzButton',
17
+ cls: 'ez-docs-copy-btn',
18
+ icon: 'fa-solid fa-copy',
19
+ variant: 'ghost',
20
+ size: 'sm',
21
+ bind: {
22
+ visible: () => !!ctrl.state.selectedVariant
23
+ },
24
+ onClick: () => {
25
+ const variant = ctrl.state.selectedVariant;
26
+ if (variant) {
27
+ const code = ctrl.formatCode(variant.config);
28
+ navigator.clipboard.writeText(code);
29
+ ez.toast?.('Copied to clipboard', { variant: 'success' });
30
+ }
31
+ }
32
+ }
33
+ ]
34
+ },
35
+ {
36
+ eztype: 'EzComponent',
37
+ cls: 'ez-docs-code-panel-content',
38
+ bind: {
39
+ html: () => {
40
+ const variant = ctrl.state.selectedVariant;
41
+ if (!variant) {
42
+ return '<div class="ez-docs-code-placeholder">Click a component to see its code</div>';
43
+ }
44
+ return `<pre>${ctrl.formatCode(variant.config)}</pre>`;
45
+ }
46
+ }
47
+ }
48
+ ]
49
+ };
50
+ }
51
+ });
@@ -0,0 +1,315 @@
1
+ ez.define('EzDocsContent', {
2
+ template(props) {
3
+ const { componentName, docs, info } = props || {};
4
+
5
+ if (!docs) {
6
+ return buildGenericDocumentation(componentName, info);
7
+ }
8
+
9
+ return {
10
+ eztype: 'EzComponent',
11
+ cls: 'ez-docs-viewer-body',
12
+ items: buildRichDocumentation(componentName, docs)
13
+ };
14
+ }
15
+ });
16
+
17
+ function buildRichDocumentation(componentName, docs) {
18
+ const sections = [];
19
+
20
+ if (docs.features?.length) {
21
+ sections.push({
22
+ eztype: 'EzComponent',
23
+ cls: 'ez-docs-section',
24
+ items: [
25
+ { eztype: 'EzLabel', cls: 'ez-docs-section-title', text: 'Features' },
26
+ {
27
+ eztype: 'ul',
28
+ cls: 'ez-docs-feature-list',
29
+ items: docs.features.map(feature => ({
30
+ eztype: 'li',
31
+ text: feature
32
+ }))
33
+ }
34
+ ]
35
+ });
36
+ }
37
+
38
+ if (docs.usage) {
39
+ if (typeof docs.usage === 'object' && docs.usage.config) {
40
+ sections.push(buildUsageSection('Basic Usage', docs.usage));
41
+ } else {
42
+ sections.push(buildCodeSection('Basic Usage', docs.usage));
43
+ }
44
+ }
45
+
46
+ if (docs.gridSections?.length) {
47
+ for (const gridSection of docs.gridSections) {
48
+ sections.push(buildGridSection(gridSection));
49
+ }
50
+ }
51
+
52
+ if (docs.gridUsage) {
53
+ sections.push(buildCodeSection('Usage with EzGrid', docs.gridUsage));
54
+ }
55
+
56
+ if (docs.validationExample) {
57
+ sections.push(buildCodeSection('Validation', docs.validationExample));
58
+ }
59
+
60
+ if (docs.routingExample) {
61
+ sections.push(buildCodeSection('Routing Integration', docs.routingExample));
62
+ }
63
+
64
+ if (docs.middlewareExample) {
65
+ sections.push(buildCodeSection('Middleware', docs.middlewareExample));
66
+ }
67
+
68
+ if (docs.guardsExample) {
69
+ sections.push(buildCodeSection('Route Guards', docs.guardsExample));
70
+ }
71
+
72
+ if (docs.cssModuleExample) {
73
+ sections.push(buildCodeSection('File Naming & Output', docs.cssModuleExample));
74
+ }
75
+
76
+ if (docs.migrationGuide) {
77
+ sections.push(buildCodeSection('Migration Guide', docs.migrationGuide));
78
+ }
79
+
80
+ if (docs.api?.length) {
81
+ sections.push(buildApiTable('API Reference', docs.api, 'method', 'description'));
82
+ }
83
+
84
+ if (docs.types?.length) {
85
+ sections.push(buildTypesTable(docs.types));
86
+ }
87
+
88
+ if (docs.events?.length) {
89
+ sections.push(buildApiTable('Events', docs.events, 'event', 'description'));
90
+ }
91
+
92
+ if (docs.defaultMessages?.length) {
93
+ sections.push(buildApiTable('Default Error Messages', docs.defaultMessages, 'validator', 'message'));
94
+ }
95
+
96
+ return sections;
97
+ }
98
+
99
+ function buildCodeSection(title, code) {
100
+ return {
101
+ eztype: 'EzComponent',
102
+ cls: 'ez-docs-section',
103
+ items: [
104
+ { eztype: 'EzLabel', cls: 'ez-docs-section-title', text: title },
105
+ {
106
+ eztype: 'EzComponent',
107
+ cls: 'ez-docs-code-block',
108
+ items: [{ eztype: 'pre', text: code }]
109
+ }
110
+ ]
111
+ };
112
+ }
113
+
114
+ function buildUsageSection(title, usage) {
115
+ const { config, code } = usage;
116
+ const codeText = code || formatGridConfig(config);
117
+
118
+ return {
119
+ eztype: 'EzComponent',
120
+ cls: 'ez-docs-section',
121
+ items: [
122
+ { eztype: 'EzLabel', cls: 'ez-docs-section-title', text: title },
123
+ {
124
+ eztype: 'EzTabPanel',
125
+ variant: 'compact',
126
+ tabs: [
127
+ {
128
+ id: 'preview',
129
+ title: 'Preview',
130
+ icon: 'fa-solid fa-eye',
131
+ items: [
132
+ {
133
+ eztype: 'EzComponent',
134
+ cls: 'ez-docs-usage-preview',
135
+ style: { padding: '16px' },
136
+ items: [config]
137
+ }
138
+ ]
139
+ },
140
+ {
141
+ id: 'code',
142
+ title: 'Code',
143
+ icon: 'fa-solid fa-code',
144
+ items: [
145
+ {
146
+ eztype: 'EzComponent',
147
+ cls: 'ez-docs-code-block',
148
+ style: { margin: 0, borderRadius: 0 },
149
+ items: [{ eztype: 'pre', text: codeText }]
150
+ }
151
+ ]
152
+ }
153
+ ]
154
+ }
155
+ ]
156
+ };
157
+ }
158
+
159
+ function buildGridSection(gridSection) {
160
+ return {
161
+ eztype: 'EzComponent',
162
+ cls: 'ez-docs-section ez-docs-grid-section',
163
+ items: [
164
+ { eztype: 'EzLabel', cls: 'ez-docs-section-title', text: gridSection.title },
165
+ {
166
+ eztype: 'EzTabPanel',
167
+ variant: 'compact',
168
+ tabs: [
169
+ {
170
+ id: 'preview',
171
+ title: 'Preview',
172
+ icon: 'fa-solid fa-eye',
173
+ items: [
174
+ {
175
+ eztype: 'EzComponent',
176
+ cls: 'ez-docs-grid-preview',
177
+ style: { padding: '16px' },
178
+ items: [gridSection.config]
179
+ }
180
+ ]
181
+ },
182
+ {
183
+ id: 'code',
184
+ title: 'Code',
185
+ icon: 'fa-solid fa-code',
186
+ items: [
187
+ {
188
+ eztype: 'EzComponent',
189
+ cls: 'ez-docs-code-block',
190
+ style: { margin: 0, borderRadius: 0 },
191
+ items: [{
192
+ eztype: 'pre',
193
+ text: formatGridConfig(gridSection.config)
194
+ }]
195
+ }
196
+ ]
197
+ }
198
+ ]
199
+ }
200
+ ]
201
+ };
202
+ }
203
+
204
+ function buildApiTable(title, items, keyField, valueField) {
205
+ return {
206
+ eztype: 'EzComponent',
207
+ cls: 'ez-docs-section',
208
+ items: [
209
+ { eztype: 'EzLabel', cls: 'ez-docs-section-title', text: title },
210
+ {
211
+ eztype: 'EzComponent',
212
+ cls: 'ez-docs-api-table',
213
+ items: [
214
+ {
215
+ eztype: 'EzComponent',
216
+ cls: 'ez-docs-api-row ez-docs-api-header',
217
+ items: [
218
+ { eztype: 'EzLabel', cls: 'ez-docs-api-method', text: keyField.charAt(0).toUpperCase() + keyField.slice(1) },
219
+ { eztype: 'EzLabel', cls: 'ez-docs-api-desc', text: 'Description' }
220
+ ]
221
+ },
222
+ ...items.map(item => ({
223
+ eztype: 'EzComponent',
224
+ cls: 'ez-docs-api-row',
225
+ items: [
226
+ { eztype: 'code', cls: 'ez-docs-api-method', text: item[keyField] },
227
+ { eztype: 'EzLabel', cls: 'ez-docs-api-desc', text: item[valueField] }
228
+ ]
229
+ }))
230
+ ]
231
+ }
232
+ ]
233
+ };
234
+ }
235
+
236
+ function buildTypesTable(types) {
237
+ return {
238
+ eztype: 'EzComponent',
239
+ cls: 'ez-docs-section',
240
+ items: [
241
+ { eztype: 'EzLabel', cls: 'ez-docs-section-title', text: 'Supported Types' },
242
+ {
243
+ eztype: 'EzComponent',
244
+ cls: 'ez-docs-api-table',
245
+ items: [
246
+ {
247
+ eztype: 'EzComponent',
248
+ cls: 'ez-docs-api-row ez-docs-api-header',
249
+ items: [
250
+ { eztype: 'EzLabel', cls: 'ez-docs-type-name', text: 'Type' },
251
+ { eztype: 'EzLabel', cls: 'ez-docs-type-coercion', text: 'Coercion' },
252
+ { eztype: 'EzLabel', cls: 'ez-docs-type-example', text: 'Example' }
253
+ ]
254
+ },
255
+ ...types.map(item => ({
256
+ eztype: 'EzComponent',
257
+ cls: 'ez-docs-api-row',
258
+ items: [
259
+ { eztype: 'code', cls: 'ez-docs-type-name', text: item.type },
260
+ { eztype: 'code', cls: 'ez-docs-type-coercion', text: item.coercion },
261
+ { eztype: 'EzLabel', cls: 'ez-docs-type-example', text: item.example }
262
+ ]
263
+ }))
264
+ ]
265
+ }
266
+ ]
267
+ };
268
+ }
269
+
270
+ function buildGenericDocumentation(componentName, info) {
271
+ return {
272
+ eztype: 'EzComponent',
273
+ cls: 'ez-docs-viewer-body',
274
+ items: [
275
+ {
276
+ eztype: 'EzComponent',
277
+ cls: 'ez-docs-section',
278
+ items: [
279
+ { eztype: 'EzLabel', cls: 'ez-docs-section-title', text: 'Overview' },
280
+ {
281
+ eztype: 'EzLabel',
282
+ cls: 'ez-docs-section-content',
283
+ text: `Documentation for ${componentName} will be displayed here. This component is part of the ${info?.category || 'Ez'} category.`
284
+ }
285
+ ]
286
+ },
287
+ {
288
+ eztype: 'EzComponent',
289
+ cls: 'ez-docs-section',
290
+ items: [
291
+ { eztype: 'EzLabel', cls: 'ez-docs-section-title', text: 'Basic Usage' },
292
+ {
293
+ eztype: 'EzComponent',
294
+ cls: 'ez-docs-code-block',
295
+ items: [
296
+ {
297
+ eztype: 'pre',
298
+ text: `{
299
+ eztype: '${componentName}',
300
+ // ... props
301
+ }`
302
+ }
303
+ ]
304
+ }
305
+ ]
306
+ }
307
+ ]
308
+ };
309
+ }
310
+
311
+ function formatGridConfig(config) {
312
+ return JSON.stringify(config, null, 4)
313
+ .replace(/"([^"]+)":/g, '$1:')
314
+ .replace(/"/g, "'");
315
+ }
@@ -0,0 +1,46 @@
1
+ ez.define('EzDocsViewerHeader', {
2
+ template(props) {
3
+ const { componentName, info } = props || {};
4
+
5
+ return {
6
+ eztype: 'EzComponent',
7
+ cls: 'ez-docs-viewer-header',
8
+ items: [
9
+ {
10
+ eztype: 'EzComponent',
11
+ cls: 'ez-docs-viewer-breadcrumb',
12
+ items: [
13
+ {
14
+ eztype: 'EzLabel',
15
+ cls: 'ez-docs-breadcrumb-link',
16
+ text: 'Docs',
17
+ onClick: () => ez.go('/admin/docs')
18
+ },
19
+ { eztype: 'EzLabel', text: ' / ' },
20
+ {
21
+ eztype: 'EzLabel',
22
+ cls: 'ez-docs-breadcrumb-category',
23
+ text: info?.category || 'Component'
24
+ },
25
+ { eztype: 'EzLabel', text: ' / ' },
26
+ {
27
+ eztype: 'EzLabel',
28
+ cls: 'ez-docs-breadcrumb-current',
29
+ text: componentName
30
+ }
31
+ ]
32
+ },
33
+ {
34
+ eztype: 'EzLabel',
35
+ cls: 'ez-docs-viewer-title',
36
+ text: componentName
37
+ },
38
+ {
39
+ eztype: 'EzLabel',
40
+ cls: 'ez-docs-viewer-description',
41
+ text: info?.description || 'No description available'
42
+ }
43
+ ]
44
+ };
45
+ }
46
+ });
@@ -0,0 +1,59 @@
1
+ ez.define('EzDocsShowcase', {
2
+ controller: 'EzDocs',
3
+ template(props) {
4
+ const { docs } = props || {};
5
+ const ctrl = ez.getControllerSync('EzDocs');
6
+ const sections = docs?.sections || [];
7
+
8
+ return {
9
+ eztype: 'EzComponent',
10
+ cls: 'ez-docs-showcase-container',
11
+ layout: 'hbox',
12
+ items: [
13
+ {
14
+ eztype: 'EzComponent',
15
+ cls: 'ez-docs-showcase-panel',
16
+ flex: 1,
17
+ items: sections.map(section => ({
18
+ eztype: 'EzDocsShowcaseSection',
19
+ props: { section }
20
+ }))
21
+ },
22
+ {
23
+ eztype: 'EzComponent',
24
+ cls: 'ez-docs-code-panel',
25
+ items: [
26
+ {
27
+ eztype: 'EzComponent',
28
+ cls: 'ez-docs-code-panel-header',
29
+ items: [
30
+ { eztype: 'i', cls: ['fa-solid', 'fa-code'] },
31
+ { eztype: 'EzLabel', text: 'Code' }
32
+ ]
33
+ },
34
+ {
35
+ eztype: 'EzComponent',
36
+ cls: 'ez-docs-code-panel-content',
37
+ bind: {
38
+ html: () => {
39
+ const variant = ctrl.state.selectedVariant;
40
+ if (!variant) {
41
+ return '<div class="ez-docs-code-placeholder">Click a component to see its code</div>';
42
+ }
43
+ const code = ctrl.formatCode(variant.config);
44
+ return `<pre>${escapeHtml(code)}</pre>`;
45
+ }
46
+ }
47
+ }
48
+ ]
49
+ }
50
+ ]
51
+ };
52
+ }
53
+ });
54
+
55
+ function escapeHtml(text) {
56
+ const div = document.createElement('div');
57
+ div.textContent = text;
58
+ return div.innerHTML;
59
+ }
@@ -0,0 +1,25 @@
1
+ ez.define('EzDocsShowcaseSection', {
2
+ template(props) {
3
+ const { section } = props || {};
4
+
5
+ return {
6
+ eztype: 'EzComponent',
7
+ cls: 'ez-docs-showcase-section',
8
+ items: [
9
+ {
10
+ eztype: 'EzLabel',
11
+ cls: 'ez-docs-showcase-section-title',
12
+ text: section.title
13
+ },
14
+ {
15
+ eztype: 'EzComponent',
16
+ cls: 'ez-docs-showcase-variants',
17
+ items: section.variants.map(variant => ({
18
+ eztype: 'EzDocsVariantItem',
19
+ props: { variant }
20
+ }))
21
+ }
22
+ ]
23
+ };
24
+ }
25
+ });
@@ -0,0 +1,29 @@
1
+ ez.define('EzDocsVariantItem', {
2
+ controller: 'EzDocs',
3
+ template(props) {
4
+ const { variant } = props || {};
5
+ const ctrl = ez.getControllerSync('EzDocs');
6
+
7
+ return {
8
+ eztype: 'EzComponent',
9
+ cls: 'ez-docs-variant-wrapper',
10
+ bind: {
11
+ cls: () => {
12
+ const isSelected = ctrl.state.selectedVariant === variant;
13
+ return isSelected
14
+ ? 'ez-docs-variant-wrapper selected'
15
+ : 'ez-docs-variant-wrapper';
16
+ }
17
+ },
18
+ onClick: () => ctrl.selectVariant(variant),
19
+ items: [
20
+ variant.config,
21
+ {
22
+ eztype: 'EzLabel',
23
+ cls: 'ez-docs-variant-label',
24
+ text: variant.label
25
+ }
26
+ ]
27
+ };
28
+ }
29
+ });
@@ -0,0 +1,48 @@
1
+ ez.define('EzDocsWelcome', {
2
+ template() {
3
+ const ctrl = ez.getControllerSync('EzDocsController');
4
+ const categories = ctrl?.state?.categories || [];
5
+
6
+ return {
7
+ eztype: 'EzComponent',
8
+ cls: 'ez-docs-welcome',
9
+ items: [
10
+ {
11
+ eztype: 'EzComponent',
12
+ cls: 'ez-docs-welcome-header',
13
+ items: [
14
+ { eztype: 'i', cls: 'fa-solid fa-book-open ez-docs-welcome-icon' },
15
+ { eztype: 'EzLabel', cls: 'ez-docs-welcome-title', text: 'Ez Framework' },
16
+ { eztype: 'EzLabel', cls: 'ez-docs-welcome-subtitle', text: 'Component Library Documentation' }
17
+ ]
18
+ },
19
+ {
20
+ eztype: 'EzComponent',
21
+ cls: 'ez-docs-categories-grid',
22
+ items: categories.map(category => ({
23
+ eztype: 'EzPanel',
24
+ icon: `fa-solid ${category.icon}`,
25
+ title: category.name,
26
+ badge: `${category.components.length}`,
27
+ noPadding: true,
28
+ items: [
29
+ {
30
+ eztype: 'EzComponent',
31
+ cls: 'ez-docs-category-items',
32
+ items: category.components.map(comp => ({
33
+ eztype: 'EzComponent',
34
+ cls: 'ez-docs-category-item',
35
+ onClick: () => ez.go(`/admin/docs/${comp.name}`),
36
+ items: [
37
+ { eztype: 'EzLabel', cls: 'ez-docs-category-item-name', text: comp.name },
38
+ { eztype: 'EzLabel', cls: 'ez-docs-category-item-desc', text: comp.description }
39
+ ]
40
+ }))
41
+ }
42
+ ]
43
+ }))
44
+ }
45
+ ]
46
+ };
47
+ }
48
+ });