diff --git a/integrations/nuxt/src/runtime/components/nuxt-theme.css b/integrations/nuxt/src/runtime/components/nuxt-theme.css index 38bea600f01..41df1eee97c 100644 --- a/integrations/nuxt/src/runtime/components/nuxt-theme.css +++ b/integrations/nuxt/src/runtime/components/nuxt-theme.css @@ -1,6 +1,5 @@ @import "@scalar/api-client/style.css"; @import "@scalar/api-reference/style.css"; - .light-mode { --scalar-background-1: #fff; --scalar-background-2: #f8fafc; diff --git a/integrations/nuxt/src/runtime/plugins/hydrateClient.js b/integrations/nuxt/src/runtime/plugins/hydrateClient.js new file mode 100644 index 00000000000..88a40900ce7 --- /dev/null +++ b/integrations/nuxt/src/runtime/plugins/hydrateClient.js @@ -0,0 +1,13 @@ +import { defineNuxtPlugin } from '#app' +import { useHead } from '#imports' +export default defineNuxtPlugin((_nuxtApp) => { + _nuxtApp.hook('app:rendered', ({ ssrContext }) => { + useHead({ + script: [ + { + children: `window.__SCALAR__ = ${JSON.stringify(ssrContext?.payload?.data ?? {})}`, + }, + ], + }) + }) +}) diff --git a/package.json b/package.json index cc8a25ea851..ef076deaa8a 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "clean:nuxt": "shx rm -rf \"**/.nuxt\"", "clean:dist": "shx rm -rf \"**/dist\"", "clean:turbo": "shx rm -rf \"**/.turbo\"", - "dev": "turbo dev --concurrency=100% --filter './examples/*' --filter './integrations/*' --filter=@scalar/nuxt --filter=@scalar/draggable --filter @scalar/components --filter @scalar/api-client --filter @scalar/nextjs-openapi", + "dev": "turbo dev --concurrency=20 --filter './examples/*' --filter './integrations/*' --filter=@scalar/nuxt --filter=@scalar/draggable --filter @scalar/components --filter @scalar/api-client --filter @scalar/nextjs-openapi", "dev:client": "turbo dev --filter @scalar/api-client", "dev:client:desktop": "turbo dev --filter scalar-app", "dev:client:app": "turbo playground:app --filter @scalar/api-client", diff --git a/packages/api-reference/src/components/Content/Schema/SchemaProperty.vue b/packages/api-reference/src/components/Content/Schema/SchemaProperty.vue index 7f6ad29000f..2055a0e8ed3 100644 --- a/packages/api-reference/src/components/Content/Schema/SchemaProperty.vue +++ b/packages/api-reference/src/components/Content/Schema/SchemaProperty.vue @@ -114,21 +114,7 @@ const generatePropertyDescription = (property?: Record) => { const getEnumFromValue = (value?: Record): any[] | [] => value?.enum || value?.items?.enum || [] -// These helpers manage how enum values are displayed: -// -// - For enums with 9 or fewer values, all values are shown. -// - For enums with more than 9 values, only first 5 are shown initially. -// - A “Show more” button reveals the remaining values. -const hasLongEnumList = computed( - () => getEnumFromValue(optimizedValue.value).length > 9, -) -const initialEnumCount = computed(() => (hasLongEnumList.value ? 5 : 9)) -const visibleEnumValues = computed(() => - getEnumFromValue(optimizedValue.value).slice(0, initialEnumCount.value), -) -const remainingEnumValues = computed(() => - getEnumFromValue(optimizedValue.value).slice(initialEnumCount.value), -) +// Enum values are now displayed using the same Disclosure pattern as object properties /** Simplified composition with `null` type. */ const optimizedValue = computed(() => optimizeValueForDisplay(props.value)) @@ -313,58 +299,53 @@ const shouldShowEnumDescriptions = computed(() => {
- - +
{ background: var(--scalar-background-1); border-top: var(--scalar-border-width) solid currentColor; } -.property-enum-values { +.property-enum-container { margin-top: 8px; +} + +.property-enum-values { list-style: none; + margin: 0; } .property-example { @@ -636,24 +621,4 @@ const shouldShowEnumDescriptions = computed(() => { font-family: var(--scalar-font-code); font-weight: var(--scalar-semibold); } -.enum-toggle-button { - align-items: center; - border: var(--scalar-border-width) solid var(--scalar-border-color); - border-radius: 13.5px; - cursor: pointer; - color: var(--scalar-color-2); - display: flex; - font-weight: var(--scalar-semibold); - gap: 4px; - margin-top: 8px; - padding: 6px 10px; - user-select: none; - white-space: nowrap; -} -.enum-toggle-button:hover { - color: var(--scalar-color-1); -} -.enum-toggle-button-icon--open { - transform: rotate(45deg); -} diff --git a/packages/galaxy/src/documents/3.1.yaml b/packages/galaxy/src/documents/3.1.yaml index 35e298f0160..39a67a00a74 100644 --- a/packages/galaxy/src/documents/3.1.yaml +++ b/packages/galaxy/src/documents/3.1.yaml @@ -718,6 +718,12 @@ components: - ice_giant - dwarf - super_earth + x-enumDescriptions: + terrestrial: A rocky planet similar to Earth or Mars. + gas_giant: A massive planet composed mainly of hydrogen and helium, like Jupiter or Saturn. + ice_giant: A planet with a large core and icy mantle, such as Uranus or Neptune. + dwarf: A small planetary body that orbits the sun but has not cleared its orbit of debris, e.g., Pluto. + super_earth: A terrestrial planet larger than Earth but smaller than ice giants. examples: - terrestrial habitabilityIndex: @@ -860,6 +866,10 @@ components: - moon - asteroid - comet + x-enumDescriptions: + moon: A natural satellite orbiting a planet. + asteroid: A small rocky body orbiting the Sun, mostly in the asteroid belt. + comet: A small icy body that releases gas and dust, forming a visible coma or tail when near the Sun. examples: - moon orbit: diff --git a/packages/workspace-store/package.json b/packages/workspace-store/package.json index f08ef9c95ee..421ab865082 100644 --- a/packages/workspace-store/package.json +++ b/packages/workspace-store/package.json @@ -25,12 +25,12 @@ "dev": "vite-node ./src/index.ts", "format": "scalar-format", "format:check": "scalar-format-check", + "generate-json-schemas": "vite-node ./scripts/generate-json-schemas.ts", "lint:check": "eslint .", "lint:fix": "eslint . --fix", "test": "vitest", "types:build": "scalar-types-build", - "types:check": "scalar-types-check", - "generate-json-schemas": "vite-node ./scripts/generate-json-schemas.ts" + "types:check": "scalar-types-check" }, "type": "module", "exports": {