@builder.io/mitosis 0.0.121 → 0.0.123

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 (47) hide show
  1. package/dist/src/constants/hooks.d.ts +1 -0
  2. package/dist/src/constants/hooks.js +1 -0
  3. package/dist/src/generators/alpine/generate.js +3 -1
  4. package/dist/src/generators/alpine/render-mount-hook.js +3 -3
  5. package/dist/src/generators/angular.js +8 -10
  6. package/dist/src/generators/builder.js +7 -6
  7. package/dist/src/generators/helpers/on-mount.d.ts +5 -0
  8. package/dist/src/generators/helpers/on-mount.js +21 -0
  9. package/dist/src/generators/html.js +16 -15
  10. package/dist/src/generators/lit/generate.js +5 -4
  11. package/dist/src/generators/marko/generate.js +5 -4
  12. package/dist/src/generators/mitosis.js +2 -2
  13. package/dist/src/generators/qwik/component-generator.js +20 -6
  14. package/dist/src/generators/qwik/component.js +2 -2
  15. package/dist/src/generators/react/generator.js +44 -19
  16. package/dist/src/generators/rsc.d.ts +2 -0
  17. package/dist/src/generators/rsc.js +27 -16
  18. package/dist/src/generators/solid/index.js +7 -6
  19. package/dist/src/generators/stencil/generate.js +5 -4
  20. package/dist/src/generators/svelte/svelte.js +9 -7
  21. package/dist/src/generators/vue/compositionApi.d.ts +2 -2
  22. package/dist/src/generators/vue/compositionApi.js +2 -2
  23. package/dist/src/generators/vue/optionsApi.d.ts +2 -2
  24. package/dist/src/generators/vue/optionsApi.js +4 -3
  25. package/dist/src/generators/vue/vue.js +68 -62
  26. package/dist/src/helpers/create-mitosis-component.d.ts +6 -1
  27. package/dist/src/helpers/create-mitosis-component.js +16 -1
  28. package/dist/src/helpers/event-handlers.d.ts +1 -0
  29. package/dist/src/helpers/event-handlers.js +5 -0
  30. package/dist/src/helpers/on-event.d.ts +13 -0
  31. package/dist/src/helpers/on-event.js +53 -0
  32. package/dist/src/helpers/output.js +2 -4
  33. package/dist/src/helpers/process-http-requests.js +4 -4
  34. package/dist/src/helpers/typescript.d.ts +4 -1
  35. package/dist/src/index.d.ts +7 -1
  36. package/dist/src/parsers/builder/builder.js +10 -6
  37. package/dist/src/parsers/jsx/function-parser.js +52 -2
  38. package/dist/src/parsers/svelte/helpers/post-process.js +5 -5
  39. package/dist/src/parsers/svelte/html/actions.js +4 -6
  40. package/dist/src/parsers/svelte/index.js +4 -1
  41. package/dist/src/parsers/svelte/instance/hooks.js +2 -2
  42. package/dist/src/parsers/svelte/instance/index.js +3 -5
  43. package/dist/src/plugins/compile-away-builder-components.js +2 -2
  44. package/dist/src/types/metadata.d.ts +1 -0
  45. package/dist/src/types/mitosis-component.d.ts +19 -8
  46. package/dist/tsconfig.build.tsbuildinfo +1 -1
  47. package/package.json +1 -1
@@ -8,6 +8,7 @@ export declare const HOOKS: {
8
8
  readonly TARGET: "useTarget";
9
9
  readonly METADATA: "useMetadata";
10
10
  readonly MOUNT: "onMount";
11
+ readonly EVENT: "onEvent";
11
12
  readonly UNMOUNT: "onUnMount";
12
13
  readonly UPDATE: "onUpdate";
13
14
  readonly INIT: "onInit";
@@ -11,6 +11,7 @@ exports.HOOKS = {
11
11
  TARGET: 'useTarget',
12
12
  METADATA: 'useMetadata',
13
13
  MOUNT: 'onMount',
14
+ EVENT: 'onEvent',
14
15
  UNMOUNT: 'onUnMount',
15
16
  UPDATE: 'onUpdate',
16
17
  INIT: 'onInit',
@@ -69,7 +69,9 @@ var replaceInputRefs = (0, lodash_1.curry)(function (json, str) {
69
69
  });
70
70
  var replaceStateWithThis = function (str) { return str.replaceAll('state.', 'this.'); };
71
71
  var getStateObjectString = function (json) {
72
- return (0, lodash_1.flow)(get_state_object_string_1.getStateObjectStringFromComponent, trim, replaceInputRefs(json), (0, render_mount_hook_1.renderMountHook)(json), (0, render_update_hooks_1.renderUpdateHooks)(json), replaceStateWithThis)(json);
72
+ return (0, lodash_1.flow)(get_state_object_string_1.getStateObjectStringFromComponent, trim, replaceInputRefs(json), (0, render_mount_hook_1.renderMountHook)(json), (0, render_update_hooks_1.renderUpdateHooks)(json), replaceStateWithThis,
73
+ // cleanup bad regexes that result in malformed JSON strings that start with `{,`
74
+ function (x) { return (x.startsWith('{,') ? x.replace('{,', '{') : x); })(json);
73
75
  };
74
76
  var bindEventHandlerKey = (0, lodash_1.flowRight)(dash_case_1.dashCase, removeOnFromEventName);
75
77
  var bindEventHandlerValue = (0, lodash_1.flowRight)(function (x) {
@@ -2,13 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.renderMountHook = void 0;
4
4
  var lodash_1 = require("lodash");
5
+ var on_mount_1 = require("../helpers/on-mount");
5
6
  var render_update_hooks_1 = require("./render-update-hooks");
6
7
  function shouldRenderMountHook(json) {
7
- return json.hooks.onMount !== undefined || (0, render_update_hooks_1.hasWatchHooks)(json);
8
+ return json.hooks.onMount.length > 0 || (0, render_update_hooks_1.hasWatchHooks)(json);
8
9
  }
9
10
  exports.renderMountHook = (0, lodash_1.curry)(function (json, objectString) {
10
- var _a, _b;
11
11
  return shouldRenderMountHook(json)
12
- ? objectString.replace(/(?:,)?(\s*)(}\s*)$/, ", init() {\n ".concat((0, render_update_hooks_1.renderWatchHooks)(json), "\n ").concat((_b = (_a = json.hooks.onMount) === null || _a === void 0 ? void 0 : _a.code) !== null && _b !== void 0 ? _b : '', "\n }$1$2"))
12
+ ? objectString.replace(/(?:,)?(\s*)(}\s*)$/, ", init() {\n ".concat((0, render_update_hooks_1.renderWatchHooks)(json), "\n ").concat((0, on_mount_1.stringifySingleScopeOnMount)(json), "\n }$1$2"))
13
13
  : objectString;
14
14
  });
@@ -56,6 +56,7 @@ var plugins_1 = require("../modules/plugins");
56
56
  var mitosis_node_1 = require("../types/mitosis-node");
57
57
  var merge_options_1 = require("../helpers/merge-options");
58
58
  var process_code_1 = require("../helpers/plugins/process-code");
59
+ var on_mount_1 = require("./helpers/on-mount");
59
60
  var BUILT_IN_COMPONENTS = new Set(['Show', 'For', 'Fragment', 'Slot']);
60
61
  var mappers = {
61
62
  Fragment: function (json, options) {
@@ -221,7 +222,7 @@ var DEFAULT_OPTIONS = {
221
222
  var componentToAngular = function (userOptions) {
222
223
  if (userOptions === void 0) { userOptions = {}; }
223
224
  return function (_a) {
224
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
225
+ var _b, _c, _d, _e, _f, _g, _h, _j;
225
226
  var _component = _a.component;
226
227
  // Make a copy we can safely mutate, similar to babel's toolchain
227
228
  var json = (0, fast_clone_1.fastClone)(_component);
@@ -283,7 +284,7 @@ var componentToAngular = function (userOptions) {
283
284
  if (options.plugins) {
284
285
  json = (0, plugins_1.runPreJsonPlugins)({ json: json, plugins: options.plugins });
285
286
  }
286
- var _o = (0, get_props_ref_1.getPropsRef)(json, true), forwardProp = _o[0], hasPropRef = _o[1];
287
+ var _k = (0, get_props_ref_1.getPropsRef)(json, true), forwardProp = _k[0], hasPropRef = _k[1];
287
288
  var childComponents = [];
288
289
  var propsTypeRef = json.propsTypeRef !== 'any' ? json.propsTypeRef : undefined;
289
290
  json.imports.forEach(function (_a) {
@@ -295,7 +296,7 @@ var componentToAngular = function (userOptions) {
295
296
  });
296
297
  });
297
298
  var customImports = (0, get_custom_imports_1.getCustomImports)(json);
298
- var _p = json.exports, localExports = _p === void 0 ? {} : _p;
299
+ var _l = json.exports, localExports = _l === void 0 ? {} : _l;
299
300
  var localExportVars = Object.keys(localExports)
300
301
  .filter(function (key) { return localExports[key].usedInLocal; })
301
302
  .map(function (key) { return "".concat(key, " = ").concat(key, ";"); });
@@ -328,7 +329,6 @@ var componentToAngular = function (userOptions) {
328
329
  }
329
330
  return "@Output() ".concat(variableName, " = new EventEmitter()");
330
331
  });
331
- var hasOnMount = Boolean((_f = json.hooks) === null || _f === void 0 ? void 0 : _f.onMount);
332
332
  var domRefs = (0, get_refs_1.getRefs)(json);
333
333
  var jsRefs = Object.keys(json.refs).filter(function (ref) { return !domRefs.has(ref); });
334
334
  var componentsUsed = Array.from((0, get_components_used_1.getComponentsUsed)(json)).filter(function (item) {
@@ -394,7 +394,7 @@ var componentToAngular = function (userOptions) {
394
394
  .join(',');
395
395
  return "const defaultProps = {".concat(defalutPropsString, "};\n");
396
396
  };
397
- var str = (0, dedent_1.dedent)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n import { ", " ", " Component ", "", " } from '@angular/core';\n ", "\n\n ", "\n ", "\n ", "\n\n @Component({\n ", "\n })\n export class ", " {\n ", "\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n ", "\n\n ", "\n\n ", "\n\n }\n "], ["\n import { ", " ", " Component ", "", " } from '@angular/core';\n ", "\n\n ", "\n ", "\n ", "\n\n @Component({\n ", "\n })\n export class ", " {\n ", "\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n ", "\n\n ", "\n\n ", "\n\n }\n "])), outputs.length ? 'Output, EventEmitter, \n' : '', ((_g = options === null || options === void 0 ? void 0 : options.experimental) === null || _g === void 0 ? void 0 : _g.inject) ? 'Inject, forwardRef,' : '', domRefs.size ? ', ViewChild, ElementRef' : '', props.size ? ', Input' : '', options.standalone ? "import { CommonModule } from '@angular/common';" : '', json.types ? json.types.join('\n') : '', getPropsDefinition({ json: json }), (0, render_imports_1.renderPreComponent)({
397
+ var str = (0, dedent_1.dedent)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n import { ", " ", " Component ", "", " } from '@angular/core';\n ", "\n\n ", "\n ", "\n ", "\n\n @Component({\n ", "\n })\n export class ", " {\n ", "\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n ", "\n\n ", "\n\n ", "\n\n }\n "], ["\n import { ", " ", " Component ", "", " } from '@angular/core';\n ", "\n\n ", "\n ", "\n ", "\n\n @Component({\n ", "\n })\n export class ", " {\n ", "\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n ", "\n\n ", "\n\n ", "\n\n }\n "])), outputs.length ? 'Output, EventEmitter, \n' : '', ((_f = options === null || options === void 0 ? void 0 : options.experimental) === null || _f === void 0 ? void 0 : _f.inject) ? 'Inject, forwardRef,' : '', domRefs.size ? ', ViewChild, ElementRef' : '', props.size ? ', Input' : '', options.standalone ? "import { CommonModule } from '@angular/common';" : '', json.types ? json.types.join('\n') : '', getPropsDefinition({ json: json }), (0, render_imports_1.renderPreComponent)({
398
398
  component: json,
399
399
  target: 'angular',
400
400
  excludeMitosisComponents: !options.standalone && !options.preserveImports,
@@ -434,13 +434,11 @@ var componentToAngular = function (userOptions) {
434
434
  })
435
435
  .join('\n'), !hasConstructor
436
436
  ? ''
437
- : "constructor(\n".concat(injectables.join(',\n'), ") {\n ").concat(!((_h = json.hooks) === null || _h === void 0 ? void 0 : _h.onInit)
437
+ : "constructor(\n".concat(injectables.join(',\n'), ") {\n ").concat(!((_g = json.hooks) === null || _g === void 0 ? void 0 : _g.onInit)
438
438
  ? ''
439
- : "\n ".concat((_j = json.hooks.onInit) === null || _j === void 0 ? void 0 : _j.code, "\n "), "\n }\n "), !hasOnMount
439
+ : "\n ".concat((_h = json.hooks.onInit) === null || _h === void 0 ? void 0 : _h.code, "\n "), "\n }\n "), !json.hooks.onMount.length
440
440
  ? ''
441
- : "ngOnInit() {\n\n ".concat(!((_k = json.hooks) === null || _k === void 0 ? void 0 : _k.onMount)
442
- ? ''
443
- : "\n ".concat((_l = json.hooks.onMount) === null || _l === void 0 ? void 0 : _l.code, "\n "), "\n }"), !((_m = json.hooks.onUpdate) === null || _m === void 0 ? void 0 : _m.length)
441
+ : "ngOnInit() {\n ".concat((0, on_mount_1.stringifySingleScopeOnMount)(json), "\n }"), !((_j = json.hooks.onUpdate) === null || _j === void 0 ? void 0 : _j.length)
444
442
  ? ''
445
443
  : "ngAfterContentChecked() {\n ".concat(json.hooks.onUpdate.reduce(function (code, hook) {
446
444
  code += hook.code;
@@ -35,6 +35,7 @@ var remove_surrounding_block_1 = require("../helpers/remove-surrounding-block");
35
35
  var state_1 = require("../helpers/state");
36
36
  var builder_1 = require("../parsers/builder");
37
37
  var symbol_processor_1 = require("../symbols/symbol-processor");
38
+ var on_mount_1 = require("./helpers/on-mount");
38
39
  var omitMetaProperties = function (obj) {
39
40
  return (0, lodash_1.omitBy)(obj, function (_value, key) { return key.startsWith('$'); });
40
41
  };
@@ -235,24 +236,24 @@ exports.blockToBuilder = blockToBuilder;
235
236
  var componentToBuilder = function (options) {
236
237
  if (options === void 0) { options = {}; }
237
238
  return function (_a) {
238
- var _b, _c, _d, _e;
239
+ var _b, _c;
239
240
  var component = _a.component;
240
241
  var hasState = (0, state_1.checkHasState)(component);
241
242
  var result = (0, fast_clone_1.fastClone)({
242
243
  data: {
243
244
  httpRequests: (_c = (_b = component === null || component === void 0 ? void 0 : component.meta) === null || _b === void 0 ? void 0 : _b.useMetadata) === null || _c === void 0 ? void 0 : _c.httpRequests,
244
- jsCode: tryFormat((0, dedent_1.dedent)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n\n ", "\n \n ", "\n "], ["\n ", "\n\n ", "\n \n ", "\n "])), !(0, has_props_1.hasProps)(component) ? '' : "var props = state;", !hasState ? '' : "Object.assign(state, ".concat((0, get_state_object_string_1.getStateObjectStringFromComponent)(component), ");"), !((_d = component.hooks.onMount) === null || _d === void 0 ? void 0 : _d.code) ? '' : component.hooks.onMount.code)),
245
- tsCode: tryFormat((0, dedent_1.dedent)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n\n ", "\n\n ", "\n "], ["\n ", "\n\n ", "\n\n ", "\n "])), !(0, has_props_1.hasProps)(component) ? '' : "var props = state;", !hasState ? '' : "useState(".concat((0, get_state_object_string_1.getStateObjectStringFromComponent)(component), ");"), !((_e = component.hooks.onMount) === null || _e === void 0 ? void 0 : _e.code)
245
+ jsCode: tryFormat((0, dedent_1.dedent)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n\n ", "\n \n ", "\n "], ["\n ", "\n\n ", "\n \n ", "\n "])), !(0, has_props_1.hasProps)(component) ? '' : "var props = state;", !hasState ? '' : "Object.assign(state, ".concat((0, get_state_object_string_1.getStateObjectStringFromComponent)(component), ");"), (0, on_mount_1.stringifySingleScopeOnMount)(component))),
246
+ tsCode: tryFormat((0, dedent_1.dedent)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n\n ", "\n\n ", "\n "], ["\n ", "\n\n ", "\n\n ", "\n "])), !(0, has_props_1.hasProps)(component) ? '' : "var props = state;", !hasState ? '' : "useState(".concat((0, get_state_object_string_1.getStateObjectStringFromComponent)(component), ");"), !component.hooks.onMount.length
246
247
  ? ''
247
- : "onMount(() => {\n ".concat(component.hooks.onMount.code, "\n })"))),
248
+ : "onMount(() => {\n ".concat((0, on_mount_1.stringifySingleScopeOnMount)(component), "\n })"))),
248
249
  blocks: component.children
249
250
  .filter(filter_empty_text_nodes_1.filterEmptyTextNodes)
250
251
  .map(function (child) { return (0, exports.blockToBuilder)(child, options); }),
251
252
  },
252
253
  });
253
254
  var subComponentMap = {};
254
- for (var _i = 0, _f = component.subComponents; _i < _f.length; _i++) {
255
- var subComponent = _f[_i];
255
+ for (var _i = 0, _d = component.subComponents; _i < _d.length; _i++) {
256
+ var subComponent = _d[_i];
256
257
  var name_1 = subComponent.name;
257
258
  subComponentMap[name_1] = (0, exports.componentToBuilder)(options)({
258
259
  component: subComponent,
@@ -0,0 +1,5 @@
1
+ import { MitosisComponent } from '../../types/mitosis-component';
2
+ /**
3
+ * Helper for frameworks where all `onMount()`s must share a single scope.
4
+ */
5
+ export declare const stringifySingleScopeOnMount: (json: MitosisComponent) => string;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stringifySingleScopeOnMount = void 0;
4
+ /**
5
+ * Helper for frameworks where all `onMount()`s must share a single scope.
6
+ */
7
+ var stringifySingleScopeOnMount = function (json) {
8
+ var hooks = json.hooks.onMount;
9
+ if (hooks.length === 0)
10
+ return '';
11
+ if (hooks.length === 1) {
12
+ return hooks[0].code;
13
+ }
14
+ return hooks
15
+ .map(function (hook, i) {
16
+ var hookFnName = "onMountHook_".concat(i);
17
+ return "\n function ".concat(hookFnName, "() {\n ").concat(hook.code, "\n }\n ").concat(hookFnName, "();");
18
+ })
19
+ .join('');
20
+ };
21
+ exports.stringifySingleScopeOnMount = stringifySingleScopeOnMount;
@@ -56,6 +56,7 @@ var strip_state_and_props_refs_1 = require("../helpers/strip-state-and-props-ref
56
56
  var collect_css_1 = require("../helpers/styles/collect-css");
57
57
  var plugins_1 = require("../modules/plugins");
58
58
  var mitosis_node_1 = require("../types/mitosis-node");
59
+ var on_mount_1 = require("./helpers/on-mount");
59
60
  var isAttribute = function (key) {
60
61
  return /-/.test(key);
61
62
  };
@@ -417,7 +418,7 @@ var htmlDecode = function (html) { return html.replace(/&quot;/gi, '"'); };
417
418
  var componentToHtml = function (_options) {
418
419
  if (_options === void 0) { _options = {}; }
419
420
  return function (_a) {
420
- var _b, _c, _d, _e, _f, _g, _h, _j, _k;
421
+ var _b, _c, _d, _e, _f, _g, _h;
421
422
  var component = _a.component;
422
423
  var options = (0, merge_options_1.initializeOptions)({
423
424
  target: 'html',
@@ -445,13 +446,13 @@ var componentToHtml = function (_options) {
445
446
  }
446
447
  var hasChangeListeners = Boolean(Object.keys(options.onChangeJsById).length);
447
448
  var hasGeneratedJs = Boolean(options.js.trim().length);
448
- if (hasChangeListeners || hasGeneratedJs || ((_b = json.hooks.onMount) === null || _b === void 0 ? void 0 : _b.code) || hasLoop) {
449
+ if (hasChangeListeners || hasGeneratedJs || json.hooks.onMount.length || hasLoop) {
449
450
  // TODO: collectJs helper for here and liquid
450
451
  str += "\n <script>\n (() => {\n const state = ".concat((0, get_state_object_string_1.getStateObjectStringFromComponent)(json, {
451
452
  valueMapper: function (value) {
452
453
  return addUpdateAfterSetInCode(updateReferencesInCode(value, options), options);
453
454
  },
454
- }), ";\n ").concat(componentHasProps ? "let props = {};" : '', "\n let context = null;\n let nodesToDestroy = [];\n let pendingUpdate = false;\n ").concat(!((_d = (_c = json.hooks) === null || _c === void 0 ? void 0 : _c.onInit) === null || _d === void 0 ? void 0 : _d.code) ? '' : 'let onInitOnce = false;', "\n\n function destroyAnyNodes() {\n // destroy current view template refs before rendering again\n nodesToDestroy.forEach(el => el.remove());\n nodesToDestroy = [];\n }\n ").concat(!hasChangeListeners
455
+ }), ";\n ").concat(componentHasProps ? "let props = {};" : '', "\n let context = null;\n let nodesToDestroy = [];\n let pendingUpdate = false;\n ").concat(!((_c = (_b = json.hooks) === null || _b === void 0 ? void 0 : _b.onInit) === null || _c === void 0 ? void 0 : _c.code) ? '' : 'let onInitOnce = false;', "\n\n function destroyAnyNodes() {\n // destroy current view template refs before rendering again\n nodesToDestroy.forEach(el => el.remove());\n nodesToDestroy = [];\n }\n ").concat(!hasChangeListeners
455
456
  ? ''
456
457
  : "\n \n // Function to update data bindings and loops\n // call update() when you mutate state and need the updates to reflect\n // in the dom\n function update() {\n if (pendingUpdate === true) {\n return;\n }\n pendingUpdate = true;\n ".concat(Object.keys(options.onChangeJsById)
457
458
  .map(function (key) {
@@ -461,17 +462,17 @@ var componentToHtml = function (_options) {
461
462
  }
462
463
  return "\n document.querySelectorAll(\"[data-el='".concat(key, "']\").forEach((el) => {\n ").concat(value, "\n });\n ");
463
464
  })
464
- .join('\n\n'), "\n\n destroyAnyNodes();\n\n ").concat(!((_e = json.hooks.onUpdate) === null || _e === void 0 ? void 0 : _e.length)
465
+ .join('\n\n'), "\n\n destroyAnyNodes();\n\n ").concat(!((_d = json.hooks.onUpdate) === null || _d === void 0 ? void 0 : _d.length)
465
466
  ? ''
466
467
  : "\n ".concat(json.hooks.onUpdate.reduce(function (code, hook) {
467
468
  code += addUpdateAfterSetInCode(updateReferencesInCode(hook.code, options), options);
468
469
  return code + '\n';
469
- }, ''), " \n "), "\n\n pendingUpdate = false;\n }\n\n ").concat(options.js, "\n\n // Update with initial state on first load\n update();\n "), "\n\n ").concat(!((_g = (_f = json.hooks) === null || _f === void 0 ? void 0 : _f.onInit) === null || _g === void 0 ? void 0 : _g.code)
470
+ }, ''), " \n "), "\n\n pendingUpdate = false;\n }\n\n ").concat(options.js, "\n\n // Update with initial state on first load\n update();\n "), "\n\n ").concat(!((_f = (_e = json.hooks) === null || _e === void 0 ? void 0 : _e.onInit) === null || _f === void 0 ? void 0 : _f.code)
470
471
  ? ''
471
- : "\n if (!onInitOnce) {\n ".concat(updateReferencesInCode(addUpdateAfterSetInCode((_j = (_h = json.hooks) === null || _h === void 0 ? void 0 : _h.onInit) === null || _j === void 0 ? void 0 : _j.code, options), options), "\n onInitOnce = true;\n }\n "), "\n\n ").concat(!((_k = json.hooks.onMount) === null || _k === void 0 ? void 0 : _k.code)
472
+ : "\n if (!onInitOnce) {\n ".concat(updateReferencesInCode(addUpdateAfterSetInCode((_h = (_g = json.hooks) === null || _g === void 0 ? void 0 : _g.onInit) === null || _h === void 0 ? void 0 : _h.code, options), options), "\n onInitOnce = true;\n }\n "), "\n\n ").concat(!json.hooks.onMount.length
472
473
  ? ''
473
474
  : // TODO: make prettier by grabbing only the function body
474
- "\n // onMount\n ".concat(updateReferencesInCode(addUpdateAfterSetInCode(json.hooks.onMount.code, options), options), " \n "), "\n\n ").concat(!hasShow
475
+ "\n // onMount\n ".concat(updateReferencesInCode(addUpdateAfterSetInCode((0, on_mount_1.stringifySingleScopeOnMount)(json), options), options), " \n "), "\n\n ").concat(!hasShow
475
476
  ? ''
476
477
  : "\n function showContent(el) {\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLTemplateElement/content\n // grabs the content of a node that is between <template> tags\n // iterates through child nodes to register all content including text elements\n // attaches the content after the template\n \n \n const elementFragment = el.content.cloneNode(true);\n const children = Array.from(elementFragment.childNodes)\n children.forEach(child => {\n if (el?.scope) {\n child.scope = el.scope;\n }\n if (el?.context) {\n child.context = el.context;\n }\n nodesToDestroy.push(child);\n });\n el.after(elementFragment);\n }\n \n ", "\n ").concat(!hasTextBinding
477
478
  ? ''
@@ -510,7 +511,7 @@ exports.componentToHtml = componentToHtml;
510
511
  var componentToCustomElement = function (_options) {
511
512
  if (_options === void 0) { _options = {}; }
512
513
  return function (_a) {
513
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14;
514
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13;
514
515
  var component = _a.component;
515
516
  var ComponentName = component.name;
516
517
  var kebabName = (0, lodash_1.kebabCase)(ComponentName);
@@ -523,7 +524,7 @@ var componentToCustomElement = function (_options) {
523
524
  if (options.plugins) {
524
525
  json = (0, plugins_1.runPreJsonPlugins)({ json: json, plugins: options.plugins });
525
526
  }
526
- var _15 = (0, get_props_ref_1.getPropsRef)(json, true), forwardProp = _15[0], hasPropRef = _15[1];
527
+ var _14 = (0, get_props_ref_1.getPropsRef)(json, true), forwardProp = _14[0], hasPropRef = _14[1];
527
528
  var contextVars = Object.keys(((_b = json === null || json === void 0 ? void 0 : json.context) === null || _b === void 0 ? void 0 : _b.get) || {});
528
529
  var childComponents = getChildComponents(json, options);
529
530
  var componentHasProps = (0, has_props_1.hasProps)(json);
@@ -547,7 +548,7 @@ var componentToCustomElement = function (_options) {
547
548
  });
548
549
  var setContext = [];
549
550
  for (var key in json.context.set) {
550
- var _16 = json.context.set[key], name_1 = _16.name, value = _16.value, ref = _16.ref;
551
+ var _15 = json.context.set[key], name_1 = _15.name, value = _15.value, ref = _15.ref;
551
552
  setContext.push({ name: name_1, value: value, ref: ref });
552
553
  }
553
554
  addUpdateAfterSet(json, options);
@@ -678,12 +679,12 @@ var componentToCustomElement = function (_options) {
678
679
  ? ''
679
680
  : "\n showContent(el) {\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLTemplateElement/content\n // grabs the content of a node that is between <template> tags\n // iterates through child nodes to register all content including text elements\n // attaches the content after the template\n \n \n const elementFragment = el.content.cloneNode(true);\n const children = Array.from(elementFragment.childNodes)\n children.forEach(child => {\n if (el?.scope) {\n child.scope = el.scope;\n }\n if (el?.context) {\n child.context = el.context;\n }\n this.nodesToDestroy.push(child);\n });\n el.after(elementFragment);\n }", "\n ").concat(!((_9 = options === null || options === void 0 ? void 0 : options.experimental) === null || _9 === void 0 ? void 0 : _9.attributeChangedCallback)
680
681
  ? ''
681
- : "\n attributeChangedCallback(name, oldValue, newValue) {\n ".concat((_10 = options === null || options === void 0 ? void 0 : options.experimental) === null || _10 === void 0 ? void 0 : _10.attributeChangedCallback(['name', 'oldValue', 'newValue'], json, options), "\n }\n "), "\n\n onMount() {\n ").concat(!((_11 = json.hooks.onMount) === null || _11 === void 0 ? void 0 : _11.code)
682
+ : "\n attributeChangedCallback(name, oldValue, newValue) {\n ".concat((_10 = options === null || options === void 0 ? void 0 : options.experimental) === null || _10 === void 0 ? void 0 : _10.attributeChangedCallback(['name', 'oldValue', 'newValue'], json, options), "\n }\n "), "\n\n onMount() {\n ").concat(!json.hooks.onMount.length
682
683
  ? ''
683
684
  : // TODO: make prettier by grabbing only the function body
684
- "\n // onMount\n ".concat(updateReferencesInCode(addUpdateAfterSetInCode(json.hooks.onMount.code, options), options, {
685
+ "\n // onMount\n ".concat(updateReferencesInCode(addUpdateAfterSetInCode((0, on_mount_1.stringifySingleScopeOnMount)(json), options), options, {
685
686
  contextVars: contextVars,
686
- }), "\n "), "\n }\n\n onUpdate() {\n ").concat(!((_12 = json.hooks.onUpdate) === null || _12 === void 0 ? void 0 : _12.length)
687
+ }), "\n "), "\n }\n\n onUpdate() {\n ").concat(!((_11 = json.hooks.onUpdate) === null || _11 === void 0 ? void 0 : _11.length)
687
688
  ? ''
688
689
  : "\n const self = this;\n ".concat(json.hooks.onUpdate.reduce(function (code, hook, index) {
689
690
  // create check update
@@ -736,8 +737,8 @@ var componentToCustomElement = function (_options) {
736
737
  ? ''
737
738
  : "\n // scope helper\n getScope(el, name) {\n do {\n let value = el?.scope?.[name]\n if (value !== undefined) {\n return value\n }\n } while ((el = el.parentNode));\n }\n ", "\n\n ").concat(!hasLoop
738
739
  ? ''
739
- : "\n\n // Helper to render loops\n renderLoop(template, array, itemName, itemIndex, collectionName) {\n const collection = [];\n for (let [index, value] of array.entries()) {\n const elementFragment = template.content.cloneNode(true);\n const children = Array.from(elementFragment.childNodes)\n const localScope = {};\n let scope = localScope;\n if (template?.scope) {\n const getParent = {\n get(target, prop, receiver) {\n if (prop in target) {\n return target[prop];\n }\n if (prop in template.scope) {\n return template.scope[prop];\n }\n return target[prop];\n }\n };\n scope = new Proxy(localScope, getParent);\n }\n children.forEach((child) => {\n if (itemName !== undefined) {\n scope[itemName] = value;\n }\n if (itemIndex !== undefined) {\n scope[itemIndex] = index;\n }\n if (collectionName !== undefined) {\n scope[collectionName] = array;\n }\n child.scope = scope;\n if (template.context) {\n child.context = context;\n }\n this.nodesToDestroy.push(child);\n collection.unshift(child)\n });\n }\n collection.forEach(child => template.after(child));\n }\n ", "\n }\n\n ").concat(((_13 = options === null || options === void 0 ? void 0 : options.experimental) === null || _13 === void 0 ? void 0 : _13.customElementsDefine)
740
- ? (_14 = options === null || options === void 0 ? void 0 : options.experimental) === null || _14 === void 0 ? void 0 : _14.customElementsDefine(kebabName, component, options)
740
+ : "\n\n // Helper to render loops\n renderLoop(template, array, itemName, itemIndex, collectionName) {\n const collection = [];\n for (let [index, value] of array.entries()) {\n const elementFragment = template.content.cloneNode(true);\n const children = Array.from(elementFragment.childNodes)\n const localScope = {};\n let scope = localScope;\n if (template?.scope) {\n const getParent = {\n get(target, prop, receiver) {\n if (prop in target) {\n return target[prop];\n }\n if (prop in template.scope) {\n return template.scope[prop];\n }\n return target[prop];\n }\n };\n scope = new Proxy(localScope, getParent);\n }\n children.forEach((child) => {\n if (itemName !== undefined) {\n scope[itemName] = value;\n }\n if (itemIndex !== undefined) {\n scope[itemIndex] = index;\n }\n if (collectionName !== undefined) {\n scope[collectionName] = array;\n }\n child.scope = scope;\n if (template.context) {\n child.context = context;\n }\n this.nodesToDestroy.push(child);\n collection.unshift(child)\n });\n }\n collection.forEach(child => template.after(child));\n }\n ", "\n }\n\n ").concat(((_12 = options === null || options === void 0 ? void 0 : options.experimental) === null || _12 === void 0 ? void 0 : _12.customElementsDefine)
741
+ ? (_13 = options === null || options === void 0 ? void 0 : options.experimental) === null || _13 === void 0 ? void 0 : _13.customElementsDefine(kebabName, component, options)
741
742
  : "customElements.define('".concat(kebabName, "', ").concat(ComponentName, ");"), "\n ");
742
743
  if (options.plugins) {
743
744
  str = (0, plugins_1.runPreCodePlugins)({ json: json, code: str, plugins: options.plugins });
@@ -26,6 +26,7 @@ var strip_state_and_props_refs_1 = require("../../helpers/strip-state-and-props-
26
26
  var collect_css_1 = require("../../helpers/styles/collect-css");
27
27
  var plugins_1 = require("../../modules/plugins");
28
28
  var mitosis_node_1 = require("../../types/mitosis-node");
29
+ var on_mount_1 = require("../helpers/on-mount");
29
30
  var collect_class_string_1 = require("./collect-class-string");
30
31
  var getCustomTagName = function (name, options) {
31
32
  if (!name || !(0, is_upper_case_1.isUpperCase)(name[0])) {
@@ -114,7 +115,7 @@ function processBinding(code) {
114
115
  var componentToLit = function (_options) {
115
116
  if (_options === void 0) { _options = {}; }
116
117
  return function (_a) {
117
- var _b, _c, _d, _e;
118
+ var _b, _c, _d;
118
119
  var component = _a.component;
119
120
  var options = (0, merge_options_1.initializeOptions)({ target: 'lit', component: component, defaults: _options });
120
121
  var json = (0, fast_clone_1.fastClone)(component);
@@ -189,11 +190,11 @@ var componentToLit = function (_options) {
189
190
  .map(function (refName) { return "\n @query('[ref=\"".concat(refName, "\"]')\n ").concat((0, lodash_1.camelCase)(refName), "!: HTMLElement;\n "); })
190
191
  .join('\n'), Array.from(props)
191
192
  .map(function (item) { return "@property() ".concat(item, ": any"); })
192
- .join('\n'), dataString, methodsString, !((_c = json.hooks.onMount) === null || _c === void 0 ? void 0 : _c.code)
193
+ .join('\n'), dataString, methodsString, json.hooks.onMount.length === 0
193
194
  ? ''
194
- : "connectedCallback() { ".concat(processBinding(json.hooks.onMount.code), " }"), !((_d = json.hooks.onUnMount) === null || _d === void 0 ? void 0 : _d.code)
195
+ : "connectedCallback() { ".concat(processBinding((0, on_mount_1.stringifySingleScopeOnMount)(json)), " }"), !((_c = json.hooks.onUnMount) === null || _c === void 0 ? void 0 : _c.code)
195
196
  ? ''
196
- : "disconnectedCallback() { ".concat(processBinding(json.hooks.onUnMount.code), " }"), !((_e = json.hooks.onUpdate) === null || _e === void 0 ? void 0 : _e.length)
197
+ : "disconnectedCallback() { ".concat(processBinding(json.hooks.onUnMount.code), " }"), !((_d = json.hooks.onUpdate) === null || _d === void 0 ? void 0 : _d.length)
197
198
  ? ''
198
199
  : "updated() { \n ".concat(json.hooks.onUpdate.map(function (hook) { return processBinding(hook.code); }).join('\n\n'), " \n }"), options.useShadowDom || !css.length ? '' : "<style>".concat(css, "</style>"), (0, indent_1.indent)(html, 8));
199
200
  if (options.plugins) {
@@ -40,6 +40,7 @@ var strip_state_and_props_refs_1 = require("../../helpers/strip-state-and-props-
40
40
  var collect_css_1 = require("../../helpers/styles/collect-css");
41
41
  var plugins_1 = require("../../modules/plugins");
42
42
  var mitosis_node_1 = require("../../types/mitosis-node");
43
+ var on_mount_1 = require("../helpers/on-mount");
43
44
  // Having issues with this, so off for now
44
45
  var USE_MARKO_PRETTIER = false;
45
46
  /**
@@ -134,7 +135,7 @@ function processBinding(json, code, type) {
134
135
  var componentToMarko = function (userOptions) {
135
136
  if (userOptions === void 0) { userOptions = {}; }
136
137
  return function (_a) {
137
- var _b, _c, _d;
138
+ var _b, _c;
138
139
  var component = _a.component;
139
140
  var json = (0, fast_clone_1.fastClone)(component);
140
141
  var options = (0, merge_options_1.initializeOptions)({
@@ -185,11 +186,11 @@ var componentToMarko = function (userOptions) {
185
186
  ? ''
186
187
  : "onCreate(".concat(thisHasProps ? 'input' : '', ") {\n this.state = ").concat(dataString, "\n }"), Array.from(domRefs)
187
188
  .map(function (refName) { return "get ".concat((0, lodash_1.camelCase)(refName), "() { \n return this.getEl('").concat((0, lodash_1.camelCase)(refName), "')\n }"); })
188
- .join('\n'), !((_b = json.hooks.onMount) === null || _b === void 0 ? void 0 : _b.code)
189
+ .join('\n'), !json.hooks.onMount.length
189
190
  ? ''
190
- : "onMount() { ".concat(processBinding(json, json.hooks.onMount.code, 'class'), " }"), !((_c = json.hooks.onUnMount) === null || _c === void 0 ? void 0 : _c.code)
191
+ : "onMount() { ".concat(processBinding(json, (0, on_mount_1.stringifySingleScopeOnMount)(json), 'class'), " }"), !((_b = json.hooks.onUnMount) === null || _b === void 0 ? void 0 : _b.code)
191
192
  ? ''
192
- : "onDestroy() { ".concat(processBinding(json, json.hooks.onUnMount.code, 'class'), " }"), !((_d = json.hooks.onUpdate) === null || _d === void 0 ? void 0 : _d.length)
193
+ : "onDestroy() { ".concat(processBinding(json, json.hooks.onUnMount.code, 'class'), " }"), !((_c = json.hooks.onUpdate) === null || _c === void 0 ? void 0 : _c.length)
193
194
  ? ''
194
195
  : "onRender() { ".concat(json.hooks.onUpdate
195
196
  .map(function (hook) { return processBinding(json, hook.code, 'class'); })
@@ -131,7 +131,7 @@ var mitosisCoreComponents = ['Show', 'For'];
131
131
  var componentToMitosis = function (toMitosisOptions) {
132
132
  if (toMitosisOptions === void 0) { toMitosisOptions = {}; }
133
133
  return function (_a) {
134
- var _b, _c;
134
+ var _b;
135
135
  var component = _a.component;
136
136
  var options = __assign({ format: exports.DEFAULT_FORMAT }, toMitosisOptions);
137
137
  if (options.format === 'react') {
@@ -162,7 +162,7 @@ var componentToMitosis = function (toMitosisOptions) {
162
162
  ? ''
163
163
  : "import { ".concat(!hasState ? '' : 'useStore, ', " ").concat(!refs.length ? '' : 'useRef, ', " ").concat(mitosisComponents.join(', '), " } from '@builder.io/mitosis';"), !otherComponents.length ? '' : "import { ".concat(otherComponents.join(','), " } from '@components';"), json.types ? json.types.join('\n') : '', (0, render_imports_1.renderPreComponent)({ component: json, target: 'mitosis' }), stringifiedUseMetadata && stringifiedUseMetadata !== '{}'
164
164
  ? "".concat(hooks_1.HOOKS.METADATA, "(").concat(stringifiedUseMetadata, ")")
165
- : '', component.name, !hasState ? '' : "const state = useStore(".concat((0, get_state_object_string_1.getStateObjectStringFromComponent)(json), ");"), getRefsString(json, refs), !((_b = json.hooks.onMount) === null || _b === void 0 ? void 0 : _b.code) ? '' : "onMount(() => { ".concat(json.hooks.onMount.code, " })"), !((_c = json.hooks.onUnMount) === null || _c === void 0 ? void 0 : _c.code) ? '' : "onUnMount(() => { ".concat(json.hooks.onUnMount.code, " })"), addWrapper ? '<>' : '', json.children.map(function (item) { return (0, exports.blockToMitosis)(item, options, component); }).join('\n'), addWrapper ? '</>' : '');
165
+ : '', component.name, !hasState ? '' : "const state = useStore(".concat((0, get_state_object_string_1.getStateObjectStringFromComponent)(json), ");"), getRefsString(json, refs), json.hooks.onMount.map(function (hook) { return "onMount(() => { ".concat(hook.code, " })"); }), !((_b = json.hooks.onUnMount) === null || _b === void 0 ? void 0 : _b.code) ? '' : "onUnMount(() => { ".concat(json.hooks.onUnMount.code, " })"), addWrapper ? '<>' : '', json.children.map(function (item) { return (0, exports.blockToMitosis)(item, options, component); }).join('\n'), addWrapper ? '</>' : '');
166
166
  if (options.prettier !== false) {
167
167
  try {
168
168
  str = (0, standalone_1.format)(str, {
@@ -5,6 +5,7 @@ var standalone_1 = require("prettier/standalone");
5
5
  var babel_transform_1 = require("../../helpers/babel-transform");
6
6
  var fast_clone_1 = require("../../helpers/fast-clone");
7
7
  var merge_options_1 = require("../../helpers/merge-options");
8
+ var on_event_1 = require("../../helpers/on-event");
8
9
  var process_code_1 = require("../../helpers/plugins/process-code");
9
10
  var render_imports_1 = require("../../helpers/render-imports");
10
11
  var replace_identifiers_1 = require("../../helpers/replace-identifiers");
@@ -27,6 +28,7 @@ var PLUGINS = [
27
28
  },
28
29
  },
29
30
  }); },
31
+ (0, on_event_1.processOnEventHooksPlugin)({ setBindings: false }),
30
32
  (0, process_code_1.CODE_PROCESSOR_PLUGIN)(function (codeType, json) {
31
33
  switch (codeType) {
32
34
  case 'types':
@@ -118,6 +120,7 @@ var componentToQwik = function (userOptions) {
118
120
  emitUseRef(file, component);
119
121
  if (!((_b = metadata_1 === null || metadata_1 === void 0 ? void 0 : metadata_1.qwik) === null || _b === void 0 ? void 0 : _b.setUseStoreFirst))
120
122
  emitStore_1();
123
+ emitUseOn(file, component);
121
124
  emitUseContextProvider(file, component);
122
125
  emitUseClientEffect(file, component);
123
126
  emitUseMount(file, component);
@@ -159,12 +162,11 @@ function emitExports(file, component) {
159
162
  });
160
163
  }
161
164
  function emitUseClientEffect(file, component) {
162
- if (component.hooks.onMount) {
163
- // This is called useMount, but in practice it is used as
164
- // useClientEffect. Not sure if this is correct, but for now.
165
- var code = component.hooks.onMount.code;
166
- file.src.emit(file.import(file.qwikModule, 'useVisibleTask$').localName, '(()=>{', code, '});');
167
- }
165
+ component.hooks.onMount.forEach(function (onMount) {
166
+ var code = onMount.code;
167
+ var hookToUse = onMount.onSSR ? 'useTask$' : 'useVisibleTask$';
168
+ file.src.emit(file.import(file.qwikModule, hookToUse).localName, '(()=>{', code, '});');
169
+ });
168
170
  }
169
171
  function emitUseMount(file, component) {
170
172
  if (component.hooks.onInit) {
@@ -237,6 +239,18 @@ function emitUseContext(file, component) {
237
239
  file.src.emit('const ', ctxKey, '=', file.import(file.qwikModule, 'useContext').localName, '(', context.name, ');');
238
240
  });
239
241
  }
242
+ function emitUseOn(file, component) {
243
+ component.hooks.onEvent.forEach(function (hook) {
244
+ var eventName = "\"".concat(hook.eventName, "\"");
245
+ if (hook.isRoot) {
246
+ var wrappedHandlerFn = "".concat(file.import(file.qwikModule, '$').localName, "(").concat(hook.eventArgName, " => {\n ").concat(hook.code, "\n })");
247
+ file.src.emit(file.import(file.qwikModule, 'useOn').localName, "(".concat(eventName, ", ").concat(wrappedHandlerFn, ");"));
248
+ }
249
+ else {
250
+ file.src.emit(file.import(file.qwikModule, 'useVisibleTask$').localName, "(() => {\n ".concat(hook.refName, ".value?.addEventListener(").concat(eventName, ", ").concat((0, on_event_1.getOnEventHandlerName)(hook), ");\n return () => ").concat(hook.refName, ".value?.removeEventListener(").concat(eventName, ", ").concat((0, on_event_1.getOnEventHandlerName)(hook), ");\n }) \n "));
251
+ }
252
+ });
253
+ }
240
254
  function emitUseRef(file, component) {
241
255
  Object.keys(component.refs).forEach(function (refKey) {
242
256
  file.src.emit("const ", refKey, '=', file.import(file.qwikModule, 'useSignal').localName, "".concat(file.options.isTypeScript ? '<Element>' : '', "();"));
@@ -22,6 +22,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.addCommonStyles = exports.renderUseLexicalScope = exports.addComponent = exports.createFileSet = void 0;
24
24
  var compile_away_builder_components_1 = require("../../plugins/compile-away-builder-components");
25
+ var on_mount_1 = require("../helpers/on-mount");
25
26
  var directives_1 = require("./directives");
26
27
  var handlers_1 = require("./helpers/handlers");
27
28
  var stable_serialize_1 = require("./helpers/stable-serialize");
@@ -162,12 +163,11 @@ function addComponentOnMount(componentFile, onRenderEmit, componentName, compone
162
163
  componentFile.exportConst(componentName + 'OnMount', function () {
163
164
  var _this = this;
164
165
  this.emit((0, src_generator_1.arrowFnValue)(['p'], function () {
165
- var _a;
166
166
  return _this.emit.apply(_this, __spreadArray(__spreadArray(['{',
167
167
  'const s=',
168
168
  componentFile.import(componentFile.qwikModule, 'useStore').localName,
169
169
  '(()=>{',
170
- 'const state=Object.assign({},structuredClone(typeof __STATE__==="object"&&__STATE__[p.serverStateId]),p);'], inputInitializer, false), [inlineCode((_a = component.hooks.onMount) === null || _a === void 0 ? void 0 : _a.code),
170
+ 'const state=Object.assign({},structuredClone(typeof __STATE__==="object"&&__STATE__[p.serverStateId]),p);'], inputInitializer, false), [inlineCode((0, on_mount_1.stringifySingleScopeOnMount)(component)),
171
171
  'return state;',
172
172
  '},{deep:true});',
173
173
  'const l={};',