@web-widget/vue2 0.0.9 → 0.0.11

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.
@@ -39,12 +39,14 @@ var defineVueRender = ({
39
39
  let app;
40
40
  return {
41
41
  async mount() {
42
- const shell = context.recovering && context.container.querySelector("[webwidgetshell]") || context.container.appendChild(document.createElement("div"));
42
+ const shellTag = "web-widget.shell";
43
+ const shell = context.recovering && context.container.querySelector(shellTag.replace(".", "\\.")) || context.container.appendChild(document.createElement(shellTag));
43
44
  const state = context.recovering ? context.container.querySelector(
44
- "[webwidgetstate]"
45
+ "script[as=state]"
45
46
  ) : null;
46
47
  const stateContent = context.recovering && state ? JSON.parse(state.textContent) : onPrefetchData ? await onPrefetchData(context, component, props) : void 0;
47
- const mergedProps = stateContent ? Object.assign({}, stateContent, props) : props;
48
+ state == null ? void 0 : state.remove();
49
+ const mergedProps = stateContent ? Object.assign(stateContent, props) : props;
48
50
  const vNodeData = {
49
51
  props: mergedProps
50
52
  };
@@ -45,7 +45,7 @@ var defineVueRender = ({
45
45
  } = {}) => {
46
46
  return defineRender(async (context, component, props) => {
47
47
  const state = onPrefetchData ? await onPrefetchData(context, component, props) : void 0;
48
- const mergedProps = state ? Object.assign({}, state, props) : props;
48
+ const mergedProps = state ? Object.assign(state, props) : props;
49
49
  const vNodeData = {
50
50
  props: mergedProps
51
51
  };
@@ -59,8 +59,8 @@ var defineVueRender = ({
59
59
  const content = await renderer.renderToString(app);
60
60
  const stateStringify = state ? htmlEscapeJsonString(JSON.stringify(state)) : void 0;
61
61
  return [
62
- `<div webwidgetshell>${content}</div>`,
63
- stateStringify ? `<script webwidgetstate type="application/json">${stateStringify}</script>` : ""
62
+ `<web-widget.shell>${content}</web-widget.shell>`,
63
+ stateStringify ? `<script as="state" type="application/json">${stateStringify}</script>` : ""
64
64
  ].join("");
65
65
  });
66
66
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@web-widget/vue2",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {