repl icon indicating copy to clipboard operation
repl copied to clipboard

Feat request: export injectKeyProps

Open litingyes opened this issue 10 months ago • 5 comments

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

but not export injectKeyProps symbol: https://github.com/vuejs/repl/blob/47da477696d63e89fe1fc1f2f3de2bfd82775cb0/src/types.ts#L18

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 avatar Jan 23 '25 05:01 litingyes

https://github.com/vuejs/repl/pull/309 Maybe we can use Sandbox, not relying on editor configuration

wangcch avatar Feb 13 '25 05:02 wangcch

#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

litingyes avatar Feb 13 '25 06:02 litingyes

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>

wangcch avatar Feb 13 '25 06:02 wangcch

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

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.

litingyes avatar Feb 13 '25 07:02 litingyes

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

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

wangcch avatar Feb 13 '25 08:02 wangcch