ezfw-core 1.0.60 → 1.0.62

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.
@@ -168,7 +168,11 @@ export class StaticHtmlRenderer {
168
168
  const eztype = config.eztype || 'div';
169
169
  // Check if it's a registered component
170
170
  if (ctx.registry.has(eztype)) {
171
- return this.renderComponent(eztype, ctx, config.props || {});
171
+ // Pass the entire config as props (excluding eztype and items which are structural)
172
+ // Props can be either in config.props or directly on the config object
173
+ const { eztype: _, items: __, ...configProps } = config;
174
+ const mergedProps = { ...configProps, ...(config.props || {}) };
175
+ return this.renderComponent(eztype, ctx, mergedProps);
172
176
  }
173
177
  // Check if eztype starts with uppercase (custom component)
174
178
  if (eztype[0] === eztype[0].toUpperCase() && eztype !== 'EzComponent') {
@@ -266,7 +266,11 @@ export class StaticHtmlRenderer {
266
266
 
267
267
  // Check if it's a registered component
268
268
  if (ctx.registry.has(eztype)) {
269
- return this.renderComponent(eztype, ctx, config.props || {});
269
+ // Pass the entire config as props (excluding eztype and items which are structural)
270
+ // Props can be either in config.props or directly on the config object
271
+ const { eztype: _, items: __, ...configProps } = config;
272
+ const mergedProps = { ...configProps, ...(config.props || {}) };
273
+ return this.renderComponent(eztype, ctx, mergedProps);
270
274
  }
271
275
 
272
276
  // Check if eztype starts with uppercase (custom component)
@@ -18,6 +18,72 @@ if (!globalThis.__ezSSRControllers) {
18
18
  const ssrRegistry = globalThis.__ezSSRRegistry;
19
19
  const ssrControllers = globalThis.__ezSSRControllers;
20
20
 
21
+ // Framework components for SSR (declarative versions of class-based Ez components)
22
+ function registerFrameworkComponents() {
23
+ ssrRegistry['EzIcon'] = {
24
+ template(props) {
25
+ const type = props.type || 'solid';
26
+ const classes = [`fa-${type}`];
27
+ if (props.fa) classes.push(`fa-${props.fa}`);
28
+ if (props.spin) classes.push('fa-spin');
29
+ if (props.pulse) classes.push('fa-pulse');
30
+ if (props.bounce) classes.push('fa-bounce');
31
+
32
+ const sizeMap = {
33
+ xxs: '0.65em', xs: '0.75em', sm: '0.875em',
34
+ lg: '1.25em', xl: '1.5em', '2x': '2em',
35
+ '3x': '3em', '4x': '4em', '5x': '5em'
36
+ };
37
+ const semanticColors = {
38
+ primary: 'var(--ez-primary)', secondary: 'var(--ez-secondary)',
39
+ success: 'var(--ez-success)', danger: 'var(--ez-danger)',
40
+ warning: 'var(--ez-warning)', info: 'var(--ez-info)',
41
+ muted: 'var(--ez-muted)', light: 'var(--ez-light)', dark: 'var(--ez-dark)'
42
+ };
43
+
44
+ return {
45
+ eztype: 'i',
46
+ cls: classes.join(' '),
47
+ style: {
48
+ fontSize: props.size ? (sizeMap[props.size] || props.size) : undefined,
49
+ color: props.color ? (semanticColors[props.color] || props.color) : undefined
50
+ }
51
+ };
52
+ }
53
+ };
54
+
55
+ ssrRegistry['EzLabel'] = {
56
+ template(props) {
57
+ return {
58
+ eztype: 'span',
59
+ text: props.text || '',
60
+ cls: props.cls,
61
+ style: props.style
62
+ };
63
+ }
64
+ };
65
+
66
+ ssrRegistry['EzButton'] = {
67
+ template(props) {
68
+ const items = [];
69
+ if (props.iconCls) {
70
+ items.push({ eztype: 'i', cls: props.iconCls });
71
+ }
72
+ if (props.text) {
73
+ items.push({ eztype: 'span', text: props.text });
74
+ }
75
+ return {
76
+ eztype: 'button',
77
+ cls: props.cls,
78
+ style: props.style,
79
+ attr: { type: props.type || 'button', disabled: props.disabled },
80
+ items: items.length > 0 ? items : undefined,
81
+ text: items.length === 0 ? props.text : undefined
82
+ };
83
+ }
84
+ };
85
+ }
86
+
21
87
  const ezSSR = {
22
88
  _registry: ssrRegistry,
23
89
  _controllers: ssrControllers,
@@ -66,88 +132,25 @@ const ezSSR = {
66
132
  return ssrRegistry[name];
67
133
  },
68
134
 
69
- // Clear registry (useful between renders)
135
+ // Clear registry (useful between renders) - preserves framework components
70
136
  _clear() {
71
137
  Object.keys(ssrRegistry).forEach(k => delete ssrRegistry[k]);
72
138
  Object.keys(ssrControllers).forEach(k => delete ssrControllers[k]);
139
+ // Re-register framework components after clear
140
+ registerFrameworkComponents();
73
141
  }
74
142
  };
75
143
 
76
144
  // Make available globally for SSR context
77
- // Always set/update the global ez reference
78
145
  globalThis.ez = ezSSR;
79
146
  if (typeof global !== 'undefined') {
80
147
  global.ez = ezSSR;
81
148
  }
82
149
 
83
- console.log('[SSR Shim] Initialized - ez is now available globally');
84
-
85
- // Register framework components for SSR
86
- // These are declarative versions of the class-based Ez components
87
-
88
- ezSSR.define('EzIcon', {
89
- template(props) {
90
- const type = props.type || 'solid';
91
- const classes = [`fa-${type}`];
92
- if (props.fa) classes.push(`fa-${props.fa}`);
93
- if (props.spin) classes.push('fa-spin');
94
- if (props.pulse) classes.push('fa-pulse');
95
- if (props.bounce) classes.push('fa-bounce');
96
-
97
- const sizeMap = {
98
- xxs: '0.65em', xs: '0.75em', sm: '0.875em',
99
- lg: '1.25em', xl: '1.5em', '2x': '2em',
100
- '3x': '3em', '4x': '4em', '5x': '5em'
101
- };
102
- const semanticColors = {
103
- primary: 'var(--ez-primary)', secondary: 'var(--ez-secondary)',
104
- success: 'var(--ez-success)', danger: 'var(--ez-danger)',
105
- warning: 'var(--ez-warning)', info: 'var(--ez-info)',
106
- muted: 'var(--ez-muted)', light: 'var(--ez-light)', dark: 'var(--ez-dark)'
107
- };
108
-
109
- return {
110
- eztype: 'i',
111
- cls: classes.join(' '),
112
- style: {
113
- fontSize: props.size ? (sizeMap[props.size] || props.size) : undefined,
114
- color: props.color ? (semanticColors[props.color] || props.color) : undefined
115
- }
116
- };
117
- }
118
- });
119
-
120
- ezSSR.define('EzLabel', {
121
- template(props) {
122
- return {
123
- eztype: 'span',
124
- text: props.text || '',
125
- cls: props.cls,
126
- style: props.style
127
- };
128
- }
129
- });
130
-
131
- ezSSR.define('EzButton', {
132
- template(props) {
133
- const items = [];
134
- if (props.iconCls) {
135
- items.push({ eztype: 'i', cls: props.iconCls });
136
- }
137
- if (props.text) {
138
- items.push({ eztype: 'span', text: props.text });
139
- }
140
- return {
141
- eztype: 'button',
142
- cls: props.cls,
143
- style: props.style,
144
- attr: { type: props.type || 'button', disabled: props.disabled },
145
- items: items.length > 0 ? items : undefined,
146
- text: items.length === 0 ? props.text : undefined
147
- };
148
- }
149
- });
150
+ // Register framework components on init
151
+ registerFrameworkComponents();
150
152
 
153
+ console.log('[SSR Shim] Initialized - ez is now available globally');
151
154
  console.log('[SSR Shim] Framework components registered: EzIcon, EzLabel, EzButton');
152
155
 
153
156
  export { ezSSR as ez };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ezfw-core",
3
- "version": "1.0.60",
3
+ "version": "1.0.62",
4
4
  "description": "Ez Framework - A declarative component framework for building modern web applications",
5
5
  "type": "module",
6
6
  "main": "./core/ez.ts",