@teleporthq/teleport-plugin-html-base-component 0.35.0-alpha.0 → 0.35.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.
@@ -55,72 +55,103 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
55
55
  return to.concat(ar || Array.prototype.slice.call(from));
56
56
  };
57
57
  import { HTMLComponentGeneratorError, ChunkType, FileType, } from '@teleporthq/teleport-types';
58
+ import { join, relative } from 'path';
58
59
  import { HASTBuilders, HASTUtils } from '@teleporthq/teleport-plugin-common';
59
60
  import { StringUtils, UIDLUtils } from '@teleporthq/teleport-shared';
60
61
  import { staticNode } from '@teleporthq/teleport-uidl-builders';
61
62
  import { createCSSPlugin } from '@teleporthq/teleport-plugin-css';
62
63
  import { DEFAULT_COMPONENT_CHUNK_NAME } from './constants';
63
- export var generateHtmlSynatx = function (node, templatesLookUp, propDefinitions, stateDefinitions, externals, routeDefinitions, structure) { return __awaiter(void 0, void 0, void 0, function () {
64
- return __generator(this, function (_a) {
65
- switch (node.type) {
66
- case 'inject':
67
- case 'raw':
68
- return [2 /*return*/, HASTBuilders.createTextNode(node.content.toString())];
69
- case 'static':
70
- return [2 /*return*/, HASTBuilders.createTextNode(StringUtils.encode(node.content.toString()))];
71
- case 'slot':
72
- return [2 /*return*/, HASTBuilders.createHTMLNode(node.type)];
73
- case 'element':
74
- return [2 /*return*/, generatElementNode(node, templatesLookUp, propDefinitions, stateDefinitions, externals, routeDefinitions, structure)];
75
- case 'dynamic':
76
- return [2 /*return*/, generateDynamicNode(node, templatesLookUp, propDefinitions, stateDefinitions, externals, routeDefinitions, structure)];
77
- default:
78
- throw new HTMLComponentGeneratorError("generateHtmlSyntax encountered a node of unsupported type: ".concat(JSON.stringify(node, null, 2), " "));
64
+ var isValidURL = function (url) {
65
+ try {
66
+ /* tslint:disable:no-unused-expression */
67
+ new URL(url);
68
+ return true;
69
+ }
70
+ catch (error) {
71
+ return false;
72
+ }
73
+ };
74
+ export var generateHtmlSyntax = function (node, nodesLookup, propDefinitions, stateDefinitions, subComponentOptions, structure) { return __awaiter(void 0, void 0, void 0, function () {
75
+ var _a, elementNode, dynamicNode;
76
+ return __generator(this, function (_b) {
77
+ switch (_b.label) {
78
+ case 0:
79
+ _a = node.type;
80
+ switch (_a) {
81
+ case 'inject': return [3 /*break*/, 1];
82
+ case 'raw': return [3 /*break*/, 1];
83
+ case 'static': return [3 /*break*/, 2];
84
+ case 'slot': return [3 /*break*/, 3];
85
+ case 'element': return [3 /*break*/, 4];
86
+ case 'dynamic': return [3 /*break*/, 6];
87
+ }
88
+ return [3 /*break*/, 8];
89
+ case 1: return [2 /*return*/, HASTBuilders.createTextNode(node.content.toString())];
90
+ case 2: return [2 /*return*/, HASTBuilders.createTextNode(StringUtils.encode(node.content.toString()))];
91
+ case 3: return [2 /*return*/, HASTBuilders.createHTMLNode(node.type)];
92
+ case 4: return [4 /*yield*/, generateElementNode(node, nodesLookup, propDefinitions, stateDefinitions, subComponentOptions, structure)];
93
+ case 5:
94
+ elementNode = _b.sent();
95
+ return [2 /*return*/, elementNode];
96
+ case 6: return [4 /*yield*/, generateDynamicNode(node, nodesLookup, propDefinitions, stateDefinitions, subComponentOptions, structure)];
97
+ case 7:
98
+ dynamicNode = _b.sent();
99
+ return [2 /*return*/, dynamicNode];
100
+ case 8: throw new HTMLComponentGeneratorError("generateHtmlSyntax encountered a node of unsupported type: ".concat(JSON.stringify(node, null, 2), " "));
79
101
  }
80
- return [2 /*return*/];
81
102
  });
82
103
  }); };
83
- var generatElementNode = function (node, templatesLookUp, propDefinitions, stateDefinitions, externals, routeDefinitions, structure) { return __awaiter(void 0, void 0, void 0, function () {
84
- var _a, elementType, children, _b, attrs, _c, style, _d, referencedStyles, dependency, key, elementNode, dependencies, compTag, _i, children_1, child, childTag;
85
- return __generator(this, function (_e) {
86
- switch (_e.label) {
104
+ var generateElementNode = function (node, nodesLookup, propDefinitions, stateDefinitions, subComponentOptions, structure) { return __awaiter(void 0, void 0, void 0, function () {
105
+ var _a, elementType, children, _b, attrs, _c, style, _d, referencedStyles, dependency, key, dependencies, _i, _e, attrKey, attr, compTag, elementNode, _f, children_1, child, childTag;
106
+ return __generator(this, function (_g) {
107
+ switch (_g.label) {
87
108
  case 0:
88
109
  _a = node.content, elementType = _a.elementType, children = _a.children, _b = _a.attrs, attrs = _b === void 0 ? {} : _b, _c = _a.style, style = _c === void 0 ? {} : _c, _d = _a.referencedStyles, referencedStyles = _d === void 0 ? {} : _d, dependency = _a.dependency, key = _a.key;
89
- elementNode = HASTBuilders.createHTMLNode(elementType);
90
- templatesLookUp[key] = elementNode;
91
110
  dependencies = structure.dependencies;
92
111
  if (dependency && (dependency === null || dependency === void 0 ? void 0 : dependency.type) !== 'local') {
93
112
  dependencies[dependency.path] = dependency;
94
113
  }
95
- if (!(dependency && (dependency === null || dependency === void 0 ? void 0 : dependency.type) === 'local')) return [3 /*break*/, 2];
96
- return [4 /*yield*/, generateComponentContent(node, propDefinitions, stateDefinitions, externals, routeDefinitions, structure)];
114
+ if (!(dependency && (dependency === null || dependency === void 0 ? void 0 : dependency.type) === 'local')) return [3 /*break*/, 6];
115
+ _i = 0, _e = Object.keys(attrs);
116
+ _g.label = 1;
97
117
  case 1:
98
- compTag = _e.sent();
99
- return [2 /*return*/, compTag];
118
+ if (!(_i < _e.length)) return [3 /*break*/, 4];
119
+ attrKey = _e[_i];
120
+ attr = attrs[attrKey];
121
+ if (!(attr.type === 'element')) return [3 /*break*/, 3];
122
+ return [4 /*yield*/, generateElementNode(attr, nodesLookup, propDefinitions, stateDefinitions, subComponentOptions, structure)];
100
123
  case 2:
101
- if (!children) return [3 /*break*/, 6];
102
- _i = 0, children_1 = children;
103
- _e.label = 3;
124
+ _g.sent();
125
+ _g.label = 3;
104
126
  case 3:
105
- if (!(_i < children_1.length)) return [3 /*break*/, 6];
106
- child = children_1[_i];
107
- return [4 /*yield*/, generateHtmlSynatx(child, templatesLookUp, propDefinitions, stateDefinitions, externals, routeDefinitions, structure)];
108
- case 4:
109
- childTag = _e.sent();
110
- if (!childTag) {
111
- return [2 /*return*/];
112
- }
127
+ _i++;
128
+ return [3 /*break*/, 1];
129
+ case 4: return [4 /*yield*/, generateComponentContent(node, nodesLookup, propDefinitions, stateDefinitions, subComponentOptions, structure)];
130
+ case 5:
131
+ compTag = _g.sent();
132
+ return [2 /*return*/, compTag];
133
+ case 6:
134
+ elementNode = HASTBuilders.createHTMLNode(elementType);
135
+ if (!children) return [3 /*break*/, 10];
136
+ _f = 0, children_1 = children;
137
+ _g.label = 7;
138
+ case 7:
139
+ if (!(_f < children_1.length)) return [3 /*break*/, 10];
140
+ child = children_1[_f];
141
+ return [4 /*yield*/, generateHtmlSyntax(child, nodesLookup, propDefinitions, stateDefinitions, subComponentOptions, structure)];
142
+ case 8:
143
+ childTag = _g.sent();
113
144
  if (typeof childTag === 'string') {
114
145
  HASTUtils.addTextNode(elementNode, childTag);
115
146
  }
116
147
  else {
117
148
  HASTUtils.addChildNode(elementNode, childTag);
118
149
  }
119
- _e.label = 5;
120
- case 5:
121
- _i++;
122
- return [3 /*break*/, 3];
123
- case 6:
150
+ _g.label = 9;
151
+ case 9:
152
+ _f++;
153
+ return [3 /*break*/, 7];
154
+ case 10:
124
155
  if (Object.keys(referencedStyles).length > 0) {
125
156
  Object.keys(referencedStyles).forEach(function (styleRef) {
126
157
  var refStyle = referencedStyles[styleRef];
@@ -133,30 +164,31 @@ var generatElementNode = function (node, templatesLookUp, propDefinitions, state
133
164
  if (Object.keys(style).length > 0) {
134
165
  handleStyles(node, style, propDefinitions, stateDefinitions);
135
166
  }
136
- if (Object.keys(attrs).length > 0) {
137
- handleAttributes(elementNode, attrs, propDefinitions, stateDefinitions, routeDefinitions);
138
- }
167
+ handleAttributes(elementType, elementNode, attrs, propDefinitions, stateDefinitions, structure.options.projectRouteDefinition, structure.outputOptions);
168
+ nodesLookup[key] = elementNode;
139
169
  return [2 /*return*/, elementNode];
140
170
  }
141
171
  });
142
172
  }); };
143
- var generateComponentContent = function (node, propDefinitions, stateDefinitions, externals, routeDefinitions, structure) { return __awaiter(void 0, void 0, void 0, function () {
144
- var _a, elementType, _b, attrs, key, _c, children, dependencies, chunks, options, comp, lookUpTemplates, compHasSlots, combinedProps, propsForInstance, combinedStates, statesForInstance, elementNode, compTag, cssPlugin, result, chunk, styleChunk;
145
- var _d;
146
- return __generator(this, function (_e) {
147
- switch (_e.label) {
173
+ var generateComponentContent = function (node, nodesLookup, propDefinitions, stateDefinitions, subComponentOptions, structure) { return __awaiter(void 0, void 0, void 0, function () {
174
+ var externals, plugins, _a, elementType, _b, attrs, key, _c, children, dependencies, _d, chunks, options, compName, component, componentClone, compHasSlots, combinedProps, propsForInstance, _i, _e, propKey, combinedStates, statesForInstance, componentWrapper, isExistingNode, componentInstanceToGenerate, compTag, cssPlugin, initialStructure, result, chunk, styleChunk;
175
+ var _f, _g, _h;
176
+ return __generator(this, function (_j) {
177
+ switch (_j.label) {
148
178
  case 0:
179
+ externals = subComponentOptions.externals, plugins = subComponentOptions.plugins;
149
180
  _a = node.content, elementType = _a.elementType, _b = _a.attrs, attrs = _b === void 0 ? {} : _b, key = _a.key, _c = _a.children, children = _c === void 0 ? [] : _c;
150
- dependencies = structure.dependencies, chunks = structure.chunks, options = structure.options;
151
- comp = UIDLUtils.cloneObject(externals[elementType] || {});
152
- lookUpTemplates = {};
153
- compHasSlots = false;
154
- if (!comp || !(comp === null || comp === void 0 ? void 0 : comp.node)) {
155
- throw new HTMLComponentGeneratorError("".concat(elementType, " is not found from the externals. \n\n Received ").concat(JSON.stringify(Object.keys(externals), null, 2)));
181
+ dependencies = structure.dependencies, _d = structure.chunks, chunks = _d === void 0 ? [] : _d, options = structure.options;
182
+ compName = elementType === 'Component' ? 'AppComponent' : elementType;
183
+ component = externals[compName];
184
+ if (component === undefined) {
185
+ throw new HTMLComponentGeneratorError("".concat(compName, " is missing from externals object"));
156
186
  }
187
+ componentClone = UIDLUtils.cloneObject(component);
188
+ compHasSlots = false;
157
189
  if (children.length) {
158
190
  compHasSlots = true;
159
- UIDLUtils.traverseNodes(comp.node, function (childNode, parentNode) {
191
+ UIDLUtils.traverseNodes(componentClone.node, function (childNode, parentNode) {
160
192
  var _a, _b;
161
193
  if (childNode.type === 'slot' && parentNode.type === 'element') {
162
194
  var nonSlotNodes = (_b = (_a = parentNode.content) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b.filter(function (n) { return n.type !== 'slot'; });
@@ -184,18 +216,22 @@ var generateComponentContent = function (node, propDefinitions, stateDefinitions
184
216
  */
185
217
  node.content.children = [];
186
218
  }
187
- combinedProps = __assign(__assign({}, propDefinitions), ((comp === null || comp === void 0 ? void 0 : comp.propDefinitions) || {}));
188
- propsForInstance = Object.keys(combinedProps).reduce(function (acc, propKey) {
189
- var _a, _b;
190
- if (attrs[propKey]) {
191
- acc[propKey] = __assign(__assign({}, combinedProps[propKey]), { defaultValue: ((_a = attrs[propKey]) === null || _a === void 0 ? void 0 : _a.content) || ((_b = combinedProps[propKey]) === null || _b === void 0 ? void 0 : _b.defaultValue) });
219
+ combinedProps = __assign(__assign({}, propDefinitions), ((componentClone === null || componentClone === void 0 ? void 0 : componentClone.propDefinitions) || {}));
220
+ propsForInstance = {};
221
+ for (_i = 0, _e = Object.keys(combinedProps); _i < _e.length; _i++) {
222
+ propKey = _e[_i];
223
+ // If the attribute is a named-slot, then we can directly pass the value instead of just the content
224
+ if (((_f = attrs[propKey]) === null || _f === void 0 ? void 0 : _f.type) === 'element') {
225
+ propsForInstance[propKey] = __assign(__assign({}, combinedProps[propKey]), { defaultValue: attrs[propKey] });
226
+ }
227
+ else if (attrs[propKey]) {
228
+ propsForInstance[propKey] = __assign(__assign({}, combinedProps[propKey]), { defaultValue: ((_g = attrs[propKey]) === null || _g === void 0 ? void 0 : _g.content) || ((_h = combinedProps[propKey]) === null || _h === void 0 ? void 0 : _h.defaultValue) });
192
229
  }
193
230
  else {
194
- acc[propKey] = combinedProps[propKey];
231
+ propsForInstance[propKey] = combinedProps[propKey];
195
232
  }
196
- return acc;
197
- }, {});
198
- combinedStates = __assign(__assign({}, stateDefinitions), ((comp === null || comp === void 0 ? void 0 : comp.stateDefinitions) || {}));
233
+ }
234
+ combinedStates = __assign(__assign({}, stateDefinitions), ((componentClone === null || componentClone === void 0 ? void 0 : componentClone.stateDefinitions) || {}));
199
235
  statesForInstance = Object.keys(combinedStates).reduce(function (acc, propKey) {
200
236
  var _a, _b;
201
237
  if (attrs[propKey]) {
@@ -206,41 +242,66 @@ var generateComponentContent = function (node, propDefinitions, stateDefinitions
206
242
  }
207
243
  return acc;
208
244
  }, {});
209
- elementNode = HASTBuilders.createHTMLNode(StringUtils.camelCaseToDashCase(elementType));
210
- lookUpTemplates[key] = elementNode;
211
- return [4 /*yield*/, generateHtmlSynatx(__assign(__assign({}, comp.node), { content: __assign(__assign({}, comp.node.content), { style: __assign(__assign({}, (((_d = comp.node.content) === null || _d === void 0 ? void 0 : _d.style) || {})), { display: {
212
- type: 'static',
213
- content: 'contents',
214
- } }) }) }), lookUpTemplates, propsForInstance, statesForInstance, externals, routeDefinitions, structure)];
245
+ componentWrapper = StringUtils.camelCaseToDashCase("".concat(compName, "-wrapper"));
246
+ isExistingNode = nodesLookup[componentWrapper];
247
+ if (isExistingNode !== undefined) {
248
+ componentWrapper = "".concat(componentWrapper, "-").concat(StringUtils.generateRandomString());
249
+ }
250
+ componentInstanceToGenerate = {
251
+ type: 'element',
252
+ content: {
253
+ elementType: componentWrapper,
254
+ key: componentWrapper,
255
+ children: [componentClone.node],
256
+ style: {
257
+ display: {
258
+ type: 'static',
259
+ content: 'contents',
260
+ },
261
+ },
262
+ },
263
+ };
264
+ return [4 /*yield*/, generateHtmlSyntax(componentInstanceToGenerate, nodesLookup, propsForInstance, statesForInstance, subComponentOptions, structure)];
215
265
  case 1:
216
- compTag = (_e.sent());
266
+ compTag = _j.sent();
217
267
  cssPlugin = createCSSPlugin({
218
268
  templateStyle: 'html',
219
- templateChunkName: 'html-template',
269
+ templateChunkName: DEFAULT_COMPONENT_CHUNK_NAME,
220
270
  declareDependency: 'import',
221
271
  forceScoping: true,
222
- chunkName: comp.name,
272
+ chunkName: componentClone.name,
223
273
  staticPropReferences: true,
224
274
  });
225
- return [4 /*yield*/, cssPlugin({
226
- uidl: __assign(__assign({}, comp), { propDefinitions: propsForInstance, stateDefinitions: statesForInstance }),
227
- chunks: [
228
- {
229
- type: ChunkType.HAST,
230
- fileType: FileType.HTML,
231
- name: DEFAULT_COMPONENT_CHUNK_NAME,
232
- linkAfter: [],
233
- content: compTag,
234
- meta: {
235
- nodesLookup: lookUpTemplates,
236
- },
275
+ initialStructure = {
276
+ uidl: __assign(__assign({}, componentClone), { node: componentInstanceToGenerate, propDefinitions: propsForInstance, stateDefinitions: statesForInstance }),
277
+ chunks: [
278
+ {
279
+ type: ChunkType.HAST,
280
+ fileType: FileType.HTML,
281
+ name: DEFAULT_COMPONENT_CHUNK_NAME,
282
+ linkAfter: [],
283
+ content: compTag,
284
+ meta: {
285
+ nodesLookup: nodesLookup,
237
286
  },
238
- ],
239
- dependencies: dependencies,
240
- options: options,
241
- })];
287
+ },
288
+ ],
289
+ dependencies: dependencies,
290
+ options: options,
291
+ };
292
+ return [4 /*yield*/, __spreadArray([cssPlugin], plugins, true).reduce(function (previousPluginOperation, plugin) { return __awaiter(void 0, void 0, void 0, function () {
293
+ var modifiedStructure;
294
+ return __generator(this, function (_a) {
295
+ switch (_a.label) {
296
+ case 0: return [4 /*yield*/, previousPluginOperation];
297
+ case 1:
298
+ modifiedStructure = _a.sent();
299
+ return [2 /*return*/, plugin(modifiedStructure)];
300
+ }
301
+ });
302
+ }); }, Promise.resolve(initialStructure))];
242
303
  case 2:
243
- result = _e.sent();
304
+ result = _j.sent();
244
305
  if (compHasSlots) {
245
306
  result.chunks.forEach(function (chunk) {
246
307
  if (chunk.fileType === FileType.CSS) {
@@ -249,87 +310,149 @@ var generateComponentContent = function (node, propDefinitions, stateDefinitions
249
310
  });
250
311
  }
251
312
  else {
252
- chunk = chunks.find(function (item) { return item.name === comp.name; });
313
+ chunk = chunks.find(function (item) { return item.name === componentClone.name; });
253
314
  if (!chunk) {
254
- styleChunk = result.chunks.find(function (item) { return item.name === comp.name; });
315
+ styleChunk = result.chunks.find(function (item) { return item.fileType === FileType.CSS; });
316
+ if (!styleChunk) {
317
+ return [2 /*return*/];
318
+ }
255
319
  chunks.push(styleChunk);
256
320
  }
257
321
  }
322
+ nodesLookup[key] = compTag;
258
323
  return [2 /*return*/, compTag];
259
324
  }
260
325
  });
261
326
  }); };
262
- var generateDynamicNode = function (node, _, propDefinitions, stateDefinitions) {
263
- var spanTag = HASTBuilders.createHTMLNode('span');
264
- var usedReferenceValue = node.content.referenceType === 'prop'
265
- ? getValueFromReference(node.content.id, propDefinitions)
266
- : getValueFromReference(node.content.id, stateDefinitions);
267
- HASTUtils.addTextNode(spanTag, String(usedReferenceValue));
268
- return spanTag;
269
- };
327
+ var generateDynamicNode = function (node, nodesLookup, propDefinitions, stateDefinitions, subComponentOptions, structure) { return __awaiter(void 0, void 0, void 0, function () {
328
+ var usedReferenceValue, slotNode, spanTagWrapper, commentNode, spanTag;
329
+ return __generator(this, function (_a) {
330
+ switch (_a.label) {
331
+ case 0:
332
+ usedReferenceValue = getValueFromReference(node.content.id, node.content.referenceType === 'prop' ? propDefinitions : stateDefinitions);
333
+ if (!(usedReferenceValue.type === 'element' && usedReferenceValue.defaultValue)) return [3 /*break*/, 2];
334
+ return [4 /*yield*/, generateElementNode(usedReferenceValue.defaultValue, nodesLookup, propDefinitions, stateDefinitions, subComponentOptions, structure)];
335
+ case 1:
336
+ slotNode = _a.sent();
337
+ return [2 /*return*/, slotNode];
338
+ case 2:
339
+ if (usedReferenceValue.type === 'element' && usedReferenceValue.defaultValue === undefined) {
340
+ spanTagWrapper = HASTBuilders.createHTMLNode('span');
341
+ commentNode = HASTBuilders.createComment("Content for slot ".concat(node.content.id));
342
+ HASTUtils.addChildNode(spanTagWrapper, commentNode);
343
+ return [2 /*return*/, spanTagWrapper];
344
+ }
345
+ spanTag = HASTBuilders.createHTMLNode('span');
346
+ HASTUtils.addTextNode(spanTag, String(usedReferenceValue.defaultValue));
347
+ return [2 /*return*/, spanTag];
348
+ }
349
+ });
350
+ }); };
270
351
  var handleStyles = function (node, styles, propDefinitions, stateDefinitions) {
271
352
  Object.keys(styles).forEach(function (styleKey) {
272
353
  var _a;
273
354
  var style = styles[styleKey];
274
355
  if (style.type === 'dynamic' && ((_a = style.content) === null || _a === void 0 ? void 0 : _a.referenceType) !== 'token') {
275
- if (style.content.referenceType === 'prop') {
276
- style = getValueFromReference(style.content.id, propDefinitions);
277
- }
278
- else if (style.content.referenceType === 'state') {
279
- style = getValueFromReference(style.content.id, stateDefinitions);
356
+ var referencedValue = getValueFromReference(style.content.id, style.content.referenceType === 'prop' ? propDefinitions : stateDefinitions);
357
+ if (referencedValue.type === 'string' || referencedValue.type === 'number') {
358
+ style = String(referencedValue.defaultValue);
280
359
  }
281
360
  node.content.style[styleKey] = typeof style === 'string' ? staticNode(style) : style;
282
361
  }
283
362
  });
284
363
  };
285
- var handleAttributes = function (htmlNode, attrs, propDefinitions, stateDefinitions, routeDefinitions) {
286
- Object.keys(attrs).forEach(function (attrKey) {
364
+ var handleAttributes = function (elementType, htmlNode, attrs, propDefinitions, stateDefinitions, routeDefinitions, outputOptions) {
365
+ var _loop_1 = function (attrKey) {
287
366
  var attrValue = attrs[attrKey];
288
- if (attrKey === 'href' &&
289
- attrValue.type === 'static' &&
290
- typeof attrValue.content === 'string' &&
291
- attrValue.content.startsWith('/')) {
292
- attrValue =
293
- attrValue.content === '/' ||
294
- attrValue.content ===
295
- "/".concat(StringUtils.camelCaseToDashCase(StringUtils.removeIllegalCharacters((routeDefinitions === null || routeDefinitions === void 0 ? void 0 : routeDefinitions.defaultValue) || '')))
296
- ? staticNode('index.html')
297
- : staticNode("".concat(attrValue.content.split('/').pop(), ".html"));
298
- HASTUtils.addAttributeToNode(htmlNode, attrKey, String(attrValue.content));
299
- return;
300
- }
301
- if (attrValue.type === 'dynamic') {
302
- var value = attrValue.content.referenceType === 'prop'
303
- ? getValueFromReference(attrValue.content.id, propDefinitions)
304
- : getValueFromReference(attrValue.content.id, stateDefinitions);
305
- HASTUtils.addAttributeToNode(htmlNode, attrKey, String(value));
306
- return;
307
- }
308
- if (attrValue.type === 'raw') {
309
- HASTUtils.addAttributeToNode(htmlNode, attrKey, attrValue.content);
310
- return;
311
- }
312
- if (typeof attrValue.content === 'boolean') {
313
- HASTUtils.addBooleanAttributeToNode(htmlNode, attrKey);
314
- return;
315
- }
316
- else if (typeof attrValue.content === 'string' || typeof attrValue.content === 'number') {
317
- HASTUtils.addAttributeToNode(htmlNode, attrKey, StringUtils.encode(String(attrValue.content)));
318
- return;
367
+ var type = attrValue.type, content = attrValue.content;
368
+ switch (type) {
369
+ case 'static': {
370
+ if (attrKey === 'href' && typeof content === 'string' && content.startsWith('/')) {
371
+ var targetLink = void 0;
372
+ var targetRoute = ((routeDefinitions === null || routeDefinitions === void 0 ? void 0 : routeDefinitions.values) || []).find(function (route) { return route.pageOptions.navLink === content; });
373
+ if (targetRoute) {
374
+ targetLink = targetRoute.pageOptions.navLink;
375
+ }
376
+ if (!targetRoute && content === '/home') {
377
+ targetLink = '/';
378
+ }
379
+ if (!targetLink && !targetRoute) {
380
+ targetLink = content;
381
+ }
382
+ var currentPageRoute = join.apply(void 0, __spreadArray(__spreadArray([], ((outputOptions === null || outputOptions === void 0 ? void 0 : outputOptions.folderPath) || []), false), ['./'], false));
383
+ var localPrefix = relative("/".concat(currentPageRoute), "/".concat(targetLink === '/' ? 'index' : targetLink));
384
+ HASTUtils.addAttributeToNode(htmlNode, attrKey, "".concat(localPrefix, ".html"));
385
+ break;
386
+ }
387
+ if (typeof content === 'boolean') {
388
+ htmlNode.properties[attrKey] = content === true ? 'true' : 'false';
389
+ }
390
+ else if (typeof content === 'string' || typeof attrValue.content === 'number') {
391
+ var value = StringUtils.encode(String(attrValue.content));
392
+ /*
393
+ elementType of image is always mapped to img.
394
+ For reference, check `html-mapping` file.
395
+ */
396
+ if (elementType === 'img' && attrKey === 'src' && !isValidURL(value)) {
397
+ /*
398
+ By default we just prefix all the asset paths with just the
399
+ assetPrefix that is configured in the project. But for `html` generators
400
+ we need to prefix that with the current file location.
401
+
402
+ Because, all the other frameworks have a build setup. which serves all the
403
+ assets from the `public` folder. But in the case of `html` here is how it works
404
+
405
+ We load a file from `index.html` the request for the image goes from
406
+ '...url.../public/...image...'
407
+ If it's a nested url, then the request goes from
408
+ '...url/nested/public/...image..'
409
+
410
+ But the nested folder is available only on the root. With this
411
+ The url changes prefixes to
412
+
413
+ ../public/playground_assets/..image.. etc depending on the dept the file is in.
414
+ */
415
+ value = join(relative(join.apply(void 0, outputOptions.folderPath), './'), value);
416
+ }
417
+ HASTUtils.addAttributeToNode(htmlNode, attrKey, value);
418
+ }
419
+ break;
420
+ }
421
+ case 'dynamic': {
422
+ var value = getValueFromReference(content.id, content.referenceType === 'prop' ? propDefinitions : stateDefinitions);
423
+ HASTUtils.addAttributeToNode(htmlNode, attrKey, String(value.defaultValue));
424
+ break;
425
+ }
426
+ case 'raw': {
427
+ HASTUtils.addAttributeToNode(htmlNode, attrKey, content);
428
+ break;
429
+ }
430
+ case 'element':
431
+ case 'import':
432
+ case 'expr':
433
+ break;
434
+ default: {
435
+ throw new HTMLComponentGeneratorError("Received ".concat(JSON.stringify(attrValue, null, 2), " \n in handleAttributes for html"));
436
+ }
319
437
  }
320
- });
438
+ };
439
+ for (var _i = 0, _a = Object.keys(attrs); _i < _a.length; _i++) {
440
+ var attrKey = _a[_i];
441
+ _loop_1(attrKey);
442
+ }
321
443
  };
322
444
  var getValueFromReference = function (key, definitions) {
323
445
  var usedReferenceValue = definitions[key.includes('.') ? key.split('.')[0] : key];
324
446
  if (!usedReferenceValue) {
325
447
  throw new HTMLComponentGeneratorError("Definition for ".concat(key, " is missing from ").concat(JSON.stringify(definitions, null, 2)));
326
448
  }
327
- if (!usedReferenceValue.hasOwnProperty('defaultValue')) {
328
- throw new HTMLComponentGeneratorError("Default value is missing from dynamic reference - ".concat(JSON.stringify(usedReferenceValue, null, 2)));
329
- }
330
- if (!['string', 'number', 'object'].includes(usedReferenceValue === null || usedReferenceValue === void 0 ? void 0 : usedReferenceValue.type)) {
449
+ if (['string', 'number', 'object', 'element'].includes(usedReferenceValue === null || usedReferenceValue === void 0 ? void 0 : usedReferenceValue.type) === false) {
331
450
  throw new HTMLComponentGeneratorError("Attribute is using dynamic value, but received of type ".concat(JSON.stringify(usedReferenceValue, null, 2)));
332
451
  }
333
- return String(usedReferenceValue.defaultValue);
452
+ if (usedReferenceValue.type !== 'element' &&
453
+ usedReferenceValue.hasOwnProperty('defaultValue') === false) {
454
+ throw new HTMLComponentGeneratorError("Default value is missing from dynamic reference - ".concat(JSON.stringify(usedReferenceValue, null, 2)));
455
+ }
456
+ return usedReferenceValue;
334
457
  };
335
458
  //# sourceMappingURL=node-handlers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"node-handlers.js","sourceRoot":"","sources":["../../src/node-handlers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAIL,2BAA2B,EAQ3B,SAAS,EACT,QAAQ,GAMT,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAA;AAC5E,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAgB1D,MAAM,CAAC,IAAM,kBAAkB,GAAuD,UACpF,IAAI,EACJ,eAAe,EACf,eAAe,EAC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