@builder.io/mitosis 0.7.4 → 0.7.5

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.
@@ -10,6 +10,7 @@ const hooks_1 = require("../../generators/angular/helpers/hooks");
10
10
  const parse_selector_1 = require("../../generators/angular/parse-selector");
11
11
  const bindings_1 = require("../../helpers/bindings");
12
12
  const event_handlers_1 = require("../../helpers/event-handlers");
13
+ const get_tag_name_1 = require("../../helpers/get-tag-name");
13
14
  const is_children_1 = __importDefault(require("../../helpers/is-children"));
14
15
  const is_mitosis_node_1 = require("../../helpers/is-mitosis-node");
15
16
  const remove_surrounding_block_1 = require("../../helpers/remove-surrounding-block");
@@ -299,7 +300,7 @@ const blockToAngular = ({ root, json, options = {}, blockOptions = {
299
300
  else {
300
301
  let element = null, classNames = [], attributes;
301
302
  const isComponent = childComponents.find((impName) => impName === json.name);
302
- const tagName = json.properties.$tagName;
303
+ const tagName = (0, get_tag_name_1.getBuilderTagName)(json);
303
304
  const selector = json.meta.selector || (blockOptions === null || blockOptions === void 0 ? void 0 : blockOptions.selector);
304
305
  if (selector) {
305
306
  try {
@@ -65,7 +65,7 @@ const getPropsAsCode = ({ props, propOptions, defaultProps, json, }) => {
65
65
  // Stencil adds "on" to every `@Event` so we need to remove "on" from event props
66
66
  // https://stenciljs.com/docs/events#using-events-in-jsx
67
67
  const eventType = hasTyping
68
- ? `EventEmitter<ReturnType<Required<${propsTypeRef}>["${item}"]>>`
68
+ ? `EventEmitter<Parameters<Required<${propsTypeRef}>["${item}"]>[number]> | void`
69
69
  : 'any';
70
70
  return `@Event() ${(0, event_handlers_1.getEventNameWithoutOn)(item)}: ${eventType}${defaultPropString}`;
71
71
  }
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.componentToVue = void 0;
7
+ const apply_meta_tagname_1 = require("../../helpers/apply-meta-tagname");
7
8
  const babel_transform_1 = require("../../helpers/babel-transform");
8
9
  const bindings_1 = require("../../helpers/bindings");
9
10
  const dedent_1 = require("../../helpers/dedent");
@@ -165,6 +166,8 @@ const componentToVue = (userOptions) => ({ component: _component, path }) => {
165
166
  const css = (0, collect_css_1.collectCss)(component, {
166
167
  prefix: (_b = (_a = options.cssNamespace) === null || _a === void 0 ? void 0 : _a.call(options)) !== null && _b !== void 0 ? _b : undefined,
167
168
  });
169
+ // Apply the meta tagName to the component BEFORE we strip the meta properties
170
+ (0, apply_meta_tagname_1.applyMetaTagName)(component);
168
171
  (0, strip_meta_properties_1.stripMetaProperties)(component);
169
172
  const templateStrBody = component.children
170
173
  .map((item) => (0, blocks_1.blockToVue)(item, options, { isRootNode: true }))
@@ -0,0 +1,2 @@
1
+ import { MitosisComponent } from '../types/mitosis-component';
2
+ export declare const applyMetaTagName: (json: MitosisComponent) => MitosisComponent;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.applyMetaTagName = void 0;
7
+ const legacy_1 = __importDefault(require("neotraverse/legacy"));
8
+ const is_mitosis_node_1 = require("./is-mitosis-node");
9
+ const applyMetaTagName = (json) => {
10
+ (0, legacy_1.default)(json).forEach((item) => {
11
+ if ((0, is_mitosis_node_1.isMitosisNode)(item)) {
12
+ if (item.properties.$tagName) {
13
+ item.name = item.properties.$tagName;
14
+ delete item.properties.$tagName;
15
+ }
16
+ }
17
+ });
18
+ return json;
19
+ };
20
+ exports.applyMetaTagName = applyMetaTagName;
@@ -0,0 +1,2 @@
1
+ import { MitosisNode } from '../types/mitosis-node';
2
+ export declare const getBuilderTagName: (node: MitosisNode) => string | undefined;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBuilderTagName = void 0;
4
+ const getBuilderTagName = (node) => {
5
+ return node.properties.$tagName;
6
+ };
7
+ exports.getBuilderTagName = getBuilderTagName;
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.compileAwayBuilderComponents = exports.compileAwayBuilderComponentsFromTree = exports.components = void 0;
7
+ const get_tag_name_1 = require("../helpers/get-tag-name");
7
8
  const sdk_1 = require("@builder.io/sdk");
8
9
  const json5_1 = __importDefault(require("json5"));
9
10
  const lodash_1 = require("lodash");
@@ -38,7 +39,7 @@ const wrapOutput = (node, child, components) => {
38
39
  ...(0, lodash_1.omit)(node.bindings, ...inputNames),
39
40
  },
40
41
  // TODO: forward tagName as a $tagName="..."
41
- name: node.properties._tagName || node.properties.$tagName || 'div',
42
+ name: node.properties._tagName || (0, get_tag_name_1.getBuilderTagName)(node) || 'div',
42
43
  children: Array.isArray(child) ? child : [child],
43
44
  });
44
45
  };
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "name": "Builder.io",
23
23
  "url": "https://www.builder.io"
24
24
  },
25
- "version": "0.7.4",
25
+ "version": "0.7.5",
26
26
  "homepage": "https://github.com/BuilderIO/mitosis",
27
27
  "main": "./dist/src/index.js",
28
28
  "exports": {