Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat request: export injectKeyProps #306

Open
litingyes opened this issue Jan 23, 2025 · 5 comments
Open

Feat request: export injectKeyProps #306

litingyes opened this issue Jan 23, 2025 · 5 comments

Comments

@litingyes
Copy link

already exported Preview component: https://github.com/vuejs/repl/blob/main/src/index.ts#L2

but not export injectKeyProps symbol:

export const injectKeyProps: InjectionKey<

As a result, the separate Preview component cannot be used at all: https://github.com/vuejs/repl/blob/main/src/output/Preview.vue#L20

@litingyes litingyes changed the title export injectKeyProps Feat: export injectKeyProps Jan 23, 2025
@litingyes litingyes changed the title Feat: export injectKeyProps Feat request: export injectKeyProps Jan 23, 2025
@wangcch
Copy link
Collaborator

wangcch commented Feb 13, 2025

#309
Maybe we can use Sandbox, not relying on editor configuration

@litingyes
Copy link
Author

#309 Maybe we can use Sandbox, not relying on editor configuration

Is there a difference? It looks like you just moved the code in preview to another place

@wangcch
Copy link
Collaborator

wangcch commented Feb 13, 2025

Is there a difference? It looks like you just moved the code in preview to another place
hi @litingyes

My original intention is to use Preview

before:
Previously, when using Preview, there was no store, so we needed to use injectKeyProps to configure the data.

after:
The usage is the same as Repl

<script setup>
import { Sandbox } from '@vue/repl'

const store = useStore(
  {
    vueVersion: ref('3.5.13'),
  },
  location.hash,
)
</script>

<template>
  <Sandbox :store="store" />
</template>

@litingyes
Copy link
Author

Is there a difference? It looks like you just moved the code in preview to another place
hi @litingyes

My original intention is to use Preview

before: Previously, when using Preview, there was no store, so we needed to use injectKeyProps to configure the data.

after: The usage is the same as Repl

<script setup> import { Sandbox } from '@vue/repl' const store = useStore( { vueVersion: ref('3.5.13'), }, location.hash, ) </script>

So, if the Preview component does not use inject, but uses props to pass data, isn't it the same? I don't think the benefit of your change is great, so try to make the changes as minimal as possible.

@wangcch
Copy link
Collaborator

wangcch commented Feb 13, 2025

Is there a difference? It looks like you just moved the code in preview to another place
hi @litingyes

My original intention is to use Preview
before: Previously, when using Preview, there was no store, so we needed to use injectKeyProps to configure the data.
after: The usage is the same as Repl

<script setup> import { Sandbox } from '@vue/repl' const store = useStore( { vueVersion: ref('3.5.13'), }, location.hash, ) </script>

So, if the Preview component does not use inject, but uses props to pass data, isn't it the same? I don't think the benefit of your change is great, so try to make the changes as minimal as possible.

This PR does not change the Preview, but only makes it more suitable for more scenarios.
The Sandbox is separated from the Preview. The Preview usage remains unchanged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants