@builder.io/mitosis 0.2.0 → 0.2.1

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.
@@ -229,7 +229,7 @@ var blockToSvelte = function (_a) {
229
229
  var isComponent = Boolean(tagName[0] && (0, is_upper_case_1.isUpperCase)(tagName[0]));
230
230
  if ((((_c = json.bindings.style) === null || _c === void 0 ? void 0 : _c.code) || json.properties.style) && !isComponent) {
231
231
  var useValue = ((_d = json.bindings.style) === null || _d === void 0 ? void 0 : _d.code) || json.properties.style;
232
- str += "use:mitosis_styling={".concat(useValue, "}");
232
+ str += "style={stringifyStyles(".concat(useValue, ")}");
233
233
  delete json.bindings.style;
234
234
  delete json.properties.style;
235
235
  }
@@ -269,8 +269,8 @@ var componentToSvelte = function (userProvidedOptions) {
269
269
  if (usesWritable) {
270
270
  svelteStoreImports.push('writable');
271
271
  }
272
- str += (0, dedent_1.dedent)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n <script ", ">\n ", "\n ", "\n\n ", "\n\n ", "\n ", "\n ", "\n ", "\n\n ", "\n ", "\n\n ", "\n\n ", "\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n </script>\n\n ", "\n\n ", "\n "], ["\n <script ", ">\n ", "\n ", "\n\n ", "\n\n ", "\n ", "\n "
273
- // https://svelte.dev/repl/bd9b56891f04414982517bbd10c52c82?version=3.31.0
272
+ str += (0, dedent_1.dedent)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n <script ", ">\n ", "\n ", "\n\n ", "\n\n ", "\n ", "\n ", "\n ", "\n\n ", "\n ", "\n\n ", "\n\n ", "\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n </script>\n\n ", "\n\n ", "\n "], ["\n <script ", ">\n ", "\n ", "\n\n ", "\n\n ", "\n ", "\n "
273
+ // https://github.com/sveltejs/svelte/issues/7311
274
274
  , "\n ", "\n\n ", "\n ", "\n\n ", "\n\n ", "\n ", "\n\n ", "\n\n ", "\n\n "
275
275
  // make sure this is after all other state/code is initialized
276
276
  , "\n\n ", "\n </script>\n\n ", "\n\n ", "\n "])), tsLangAttribute, !svelteImports.length ? '' : "import { ".concat(svelteImports.sort().join(', '), " } from 'svelte'"), !svelteStoreImports.length
@@ -299,10 +299,9 @@ var componentToSvelte = function (userProvidedOptions) {
299
299
  return propDeclaration;
300
300
  })
301
301
  .join('\n'),
302
- // https://svelte.dev/repl/bd9b56891f04414982517bbd10c52c82?version=3.31.0
302
+ // https://github.com/sveltejs/svelte/issues/7311
303
303
  (0, helpers_1.hasStyle)(json)
304
- ? "\n function mitosis_styling (node, vars) {\n Object.entries(vars || {}).forEach(([ p, v ]) => {\n if (p.startsWith('--')) {\n node.style.setProperty(p, v);\n } else {\n node.style[p] = v;\n }\n })\n }\n "
305
- : '', getContextCode(json), functionsString.length < 4 ? '' : functionsString, getterString.length < 4 ? '' : getterString, refs.map(function (ref) { return "let ".concat(ref); }).join('\n'), options.stateType === 'proxies'
304
+ ? (0, dedent_1.dedent)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n \tfunction stringifyStyles(stylesObj) {\n let styles = '';\n for (let key in stylesObj) {\n const dashedKey = key.replace(/[A-Z]/g, function(match) {\n return '-' + match.toLowerCase();\n });\n styles += dashedKey + \":\" + stylesObj[key] + \";\";\n }\n return styles;\n }\n "], ["\n \tfunction stringifyStyles(stylesObj) {\n let styles = '';\n for (let key in stylesObj) {\n const dashedKey = key.replace(/[A-Z]/g, function(match) {\n return '-' + match.toLowerCase();\n });\n styles += dashedKey + \":\" + stylesObj[key] + \";\";\n }\n return styles;\n }\n "]))) : '', getContextCode(json), functionsString.length < 4 ? '' : functionsString, getterString.length < 4 ? '' : getterString, refs.map(function (ref) { return "let ".concat(ref); }).join('\n'), options.stateType === 'proxies'
306
305
  ? dataString.length < 4
307
306
  ? ''
308
307
  : "let state = onChange(".concat(dataString, ", () => state = state)")
@@ -374,4 +373,4 @@ var componentToSvelte = function (userProvidedOptions) {
374
373
  };
375
374
  };
376
375
  exports.componentToSvelte = componentToSvelte;
377
- var templateObject_1, templateObject_2;
376
+ var templateObject_1, templateObject_2, templateObject_3;
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.2.0",
25
+ "version": "0.2.1",
26
26
  "homepage": "https://github.com/BuilderIO/mitosis",
27
27
  "main": "./dist/src/index.js",
28
28
  "exports": {