Skip to content

Commit

Permalink
December Release (#1536)
Browse files Browse the repository at this point in the history
  • Loading branch information
renejeglinsky authored Dec 19, 2024
2 parents a7ac427 + d270199 commit 0bb7de5
Show file tree
Hide file tree
Showing 114 changed files with 16,320 additions and 671 deletions.
1 change: 1 addition & 0 deletions .github/cli/grab-cli-texts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ${dir}/grab-cli-texts.js @sap/cds-dk "cds add --help" ${proj} > $
${dir}/grab-cli-texts.js @cap-js/cds-typer "cds-typer --help" ${proj} > ${dir}/../../tools/assets/help/cds-typer.out.md
${dir}/grab-cli-texts.js @sap/cds-dk "cds --help" ${proj} > ${dir}/../../tools/assets/help/cds-help.out.md
${dir}/grab-cli-texts.js @sap/cds-dk "cds watch --help" ${proj} > ${dir}/../../tools/assets/help/cds-watch.out.md
${dir}/grab-cli-texts.js @sap/cds-dk "cds repl --help" ${proj} > ${dir}/../../tools/assets/help/cds-repl.out.md
${dir}/grab-cli-texts.js @sap/cds-dk "cds version" ${proj} > ${dir}/../../tools/assets/help/cds-version.out.md
${dir}/grab-cli-texts.js @sap/cds-dk "cds version --markdown" ${proj} > ${dir}/../../tools/assets/help/cds-version-md.out.md
${dir}/grab-cli-texts.js @sap/cds-dk "cds env requires.db" ${proj} > ${dir}/../../tools/assets/help/cds-env-requires-db.out.md
Expand Down
4 changes: 2 additions & 2 deletions .vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ config.rewrites = rewrites
// Add custom capire info to the theme config
config.themeConfig.capire = {
versions: {
java_services: '3.5.0',
java_cds4j: '3.5.0'
java_services: '3.6.0',
java_cds4j: '3.6.1'
},
gotoLinks: [],
maven_host_base: 'https://repo1.maven.org/maven2'
Expand Down
7 changes: 7 additions & 0 deletions .vitepress/theme/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ import ImplVariants from './components/implvariants/ImplVariants.vue'
import NavScreenMenuItem from './components/implvariants/NavScreenMenuItem.vue'
import Ribbon from './components/Ribbon.vue'
import ScrollToTop from './components/ScrollToTopSimple.vue'
import WasThisHelpful from './components/WasThisHelpful.vue'
import { useRoute } from 'vitepress'
const isPreview = !!import.meta.env.VITE_CAPIRE_PREVIEW
const { Layout } = DefaultTheme
const { frontmatter } = useData()
const route = useRoute()
</script>

<template>
Expand All @@ -24,6 +28,9 @@ const { frontmatter } = useData()
<template #doc-top>
<slot name="doc-top" />
</template>
<template #doc-after>
<WasThisHelpful :key="route.path" />
</template>
<template #not-found>
<slot name="not-found" />
</template>
Expand Down
38 changes: 23 additions & 15 deletions .vitepress/theme/components/ConfigInspect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@
<div class="vp-code-group vp-doc" v-if="java">
<CodeGroup :groups="[
{ id: 'java-appyml', label: 'application.yml', lang: 'yml', group, code: javaAppyml },
{ id: 'java-sysprop', label: 'System property', lang: 'properties', group, code: javaEnvStr }
{ id: 'java-sysprop', label: 'System property', lang: 'properties', group, code: javaEnvStr, transient: true }
]" />
</div>
<div class="vp-code-group vp-doc" v-else>
<CodeGroup :groups="[
{ id: 'pkg', label: 'package/.cdsrc.json', lang: 'json', group, code: pkgStr },
{ id: 'js', label: '.cdsrc.js', lang: 'js', group, code: jsStr },
{ id: 'yml', label: '.cdsrc.yaml', lang: 'yml', group, code: ymlStr },
{ id: 'env', label: '.env file', lang: 'properties', group, code: propStr },
{ id: 'shl', label: 'Linux/macOS Shells', lang: 'sh', group, code: envStr },
{ id: 'shp', label: 'Powershell', lang: 'powershell', group, code: '$Env:'+envStr },
{ id: 'shw', label: 'Cmd Shell', lang: 'cmd', group, code: 'set '+envStr }
{ id: 'shl', label: 'Linux/macOS Shells', lang: 'sh', group, code: envStr, transient: true },
{ id: 'shp', label: 'Powershell', lang: 'powershell', group, code: '$Env:'+envStr, transient: true },
{ id: 'shw', label: 'Cmd Shell', lang: 'cmd', group, code: 'set '+envStr, transient: true }
]" />
</div>
</template>
Expand All @@ -32,12 +34,21 @@
import FloatingVue from 'floating-vue'
import yaml from 'yaml'
const { java, keyOnly, filesOnly, label:labelProp } = defineProps<{
java?: boolean,
keyOnly?: boolean,
filesOnly?: boolean,
label?: string
}>()
// sub component that renders code blocks similar to the markdown `::: code-block` syntax
const CodeGroup = defineComponent(
({ groups }) => () => [
h('div', { class: 'tabs' }, groups.flatMap((b, idx) => [
h('input', { type: 'radio', name: 'group', id: `${b.group}-${b.id}`, checked: idx === 0 }),
h('label', { for: `${b.group}-${b.id}` }, b.label)
h('div', { class: 'tabs' }, groups
.filter((b) => filesOnly ? !b.transient : true)
.flatMap((b, idx) => [
h('input', { type: 'radio', name: 'group', id: `${b.group}-${b.id}`, checked: idx === 0 }),
h('label', { for: `${b.group}-${b.id}` }, b.label)
])),
h('div', { class: 'blocks' }, groups.flatMap((b, idx) => [
h('div', { class: ['language-'+b.lang, idx === 0 ? 'active': ''] }, [
Expand All @@ -54,16 +65,11 @@
]))
], {
props: {
groups: { type: Array<{id:string, group:string, code:string, label:string, lang:string }>, required: true }
groups: { type: Array<{id:string, group:string, code:string, label:string, lang:string, transient?:boolean }>, required: true }
}
}
)
const { java, keyOnly, label:labelProp } = defineProps<{
java?: boolean,
keyOnly?: boolean,
label?: string
}>()
FloatingVue.options.themes.cfgPopper = { $extend: 'dropdown' }
const slots = useSlots()
Expand All @@ -76,6 +82,8 @@
const popperVisible = ref(false)
const group = ref()
const pkgStr = ref()
const jsStr = ref()
const ymlStr = ref()
const propStr = ref()
const envStr = ref()
const javaAppyml = ref()
Expand All @@ -100,12 +108,12 @@
const pkg = toJson(key, jsonVal ?? value)
pkgStr.value = JSON.stringify(pkg, null, 2)
jsStr.value = 'module.exports = ' + pkgStr.value.replace(/"(\w*?)":/g, '$1:')
propStr.value = `${key}=${jsonVal ? JSON.stringify(jsonVal) : value}`
envStr.value = `${key.replaceAll('_', '__').replaceAll('.', '_').toUpperCase()}=${jsonVal ? JSON.stringify(jsonVal) : value}`
javaAppyml.value = yaml.stringify(pkg)
javaAppyml.value = ymlStr.value = yaml.stringify(pkg)
javaEnvStr.value = `-D${propStr.value}`
})
function toJson(key:string, value:string): Record<string, any> {
Expand Down
4 changes: 3 additions & 1 deletion .vitepress/theme/components/ShortcutsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ watch(visible, isVisible => {
})
function onKeyDown(event) {
const { tagName, isContentEditable } = document.activeElement
if (tagName === 'INPUT' || tagName === 'TEXTAREA' || isContentEditable) return
if (document.activeElement === document.querySelectorAll(querySelectorSearchInput)[0]) return // search is active
if (event.altKey || event.ctrlKey || event.metaKey) return // only simple keys for now
if (event.key === 'Shift' && visible.value) {
Expand All @@ -92,7 +94,7 @@ function onKeyDown(event) {
}
const cmd = commands.value.find(cmd => !!cmd.keys.find(k => k.value === event.key))
const enabled = cmd && cmd.run && ('enabled' in cmd ? cmd.enabled() : true)
if (enabled) {
if (enabled) {
event.preventDefault()
cmd.run(event)
}
Expand Down
216 changes: 216 additions & 0 deletions .vitepress/theme/components/WasThisHelpful.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
<template>
<div class="helpful-container">
<p v-if="!feedbackSent">Was this page helpful?</p>
<div v-if="!feedbackSent" class="button-row">
<button
:class="{ selected: selection === 'Positive' }"
@click="handlePositive"
title="This page was helpful"
>
👍
</button>
<button
:class="{ selected: selection === 'Negative' }"
@click="handleNegative"
title="This page was not helpful"
>
👎
</button>
</div>

<p v-if="feedbackSent" class="thank-you">Thank you for your feedback!</p>

<div class="feedback-section" v-if="feedbackSelected && !feedbackSent">
<div>
<p>Thank you for your feedback!</p>
<p><br>Feel free to add an optional comment below.<br>Make sure not to include any personal information.</p>
</div>
<div class="textarea-container">
<textarea
ref="feedbackInput"
v-model="feedbackText"
:placeholder="placeholderText"
:maxlength="charLimit"
class="feedback-textarea"
></textarea>

<p class="char-count">{{ feedbackText.length }}/140</p>
</div>

<div class="send-feedback">
<button class="feedback-button" @click="sendFeedback" :disabled="!feedbackText.trim()">Send</button>
</div>
</div>

<p class="more-feedback" v-if="feedbackSelected">
More to say?
<a href="https://github.com/cap-js/docs/issues" target="_blank">
Report an issue.
</a>
</p>
</div>
</template>

<script setup>
import { ref, computed } from 'vue'
const charLimit = 140
const feedbackText = ref('')
const feedbackSelected = ref(false)
const feedbackSent = ref(false)
const selection = ref(null)
const handlePositive = () => {
if (selection.value === 'Positive') return
if (typeof window !== 'undefined' && window._paq) {
const path = new URL(window.location.href).pathname
window._paq.push(['trackEvent', path, 'Positive'])
}
feedbackSelected.value = true
selection.value = 'Positive'
}
const handleNegative = () => {
if (selection.value === 'Negative') return
if (typeof window !== 'undefined' && window._paq) {
const path = new URL(window.location.href).pathname
window._paq.push(['trackEvent', path, 'Negative'])
}
feedbackSelected.value = true
selection.value = 'Negative'
}
const sendFeedback = () => {
if (typeof window !== 'undefined' && window._paq) {
const path = new URL(window.location.href).pathname
const name = feedbackText.value.trim()
window._paq.push(['trackEvent', path, selection.value, name])
feedbackSent.value = true
}
}
const placeholderText = computed(() => {
if (selection.value === 'Positive') return 'What did you like about the page?'
if (selection.value === 'Negative') return 'What did you miss on this page?'
return ''
})
</script>

<style scoped>
.helpful-container {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 30px;
}
p {
margin: 0;
}
.button-row {
display: flex;
gap: 1rem;
margin-top: 0.5rem;
justify-content: center;
}
button {
cursor: pointer;
border: 1px solid var(--vp-c-divider);
padding: 0.5rem 1rem;
border-radius: 4px;
background: none;
}
button:hover {
border-color: var(--vp-c-brand-1);
}
button.selected {
border-color: var(--vp-c-brand-1);
font-weight: bold;
}
.feedback-button {
background-color: #3b82f7;
border: none;
font-weight: 600;
transition: opacity 0.2s;
min-width: 100px;
}
.feedback-button:hover, .feedback-button.selected {
border: none;
opacity: 0.8;
}
.feedback-button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.feedback-section {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
max-width: 500px;
gap: 0.5rem;
margin-top: 1rem;
position: relative;
text-align: center;
}
.textarea-container {
position: relative;
width: 100%;
}
.feedback-textarea {
font-family: var(--vp-font-family);
font-size: 14px;
font-weight: 500;
width: 100%;
height: 90px;
padding: 0.5rem;
border: 1px solid var(--vp-c-divider);
border-radius: 4px;
resize: none;
}
.char-count {
position: absolute;
bottom: 0.5rem;
right: 0.5rem;
font-size: 0.9rem;
color: #666;
padding: 0 0.3rem;
border-radius: 3px;
}
.send-feedback {
color: white;
text-align: center;
}
.thank-you {
margin-top: 1rem;
font-size: 1rem;
color: var(--vp-c-success);
}
.more-feedback {
margin-top: 2rem;
text-align: center;
}
.more-feedback a {
color: var(--vp-c-brand-1);
text-decoration: none;
}
.more-feedback a:hover {
text-decoration: underline;
}
</style>
9 changes: 5 additions & 4 deletions .vitepress/theme/components/indexFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ export default (pages:ContentDataCustom[], basePath:string):ContentDataCustom[]

return pages
.map(p => {
p.url = p.url?.replaceAll('@external/', '')?.replace(/\/index$/, '/') || ''
p.url = join(base, p.url)
return p
const res = { ...p } // do not mutate original data
res.url = res.url?.replaceAll('@external/', '')?.replace(/\/index$/, '/') || ''
res.url = join(base, res.url)
return res
})
.filter(p => {
const item = items.find(item => item.link && p.url.endsWith(item.link))
const item = items.find(item => item.link && p.url.endsWith(item.link.replace(/#.*/, '')))
if (item) p.title = item.text
return !!item
})
Expand Down
2 changes: 2 additions & 0 deletions .vitepress/theme/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,9 @@ main {

.constructor::before { content: 'Constructor: '; color: #999 }
.annotation::before { content: 'Annotation: '; color: #999 }
.interface::before { content: 'Interface: '; color: #999 }
.property::before { content: 'Property: '; color: #999 }
.type::before { content: 'Type: '; color: #999 }
.method::before { content: 'Method: '; color: #999 }
.event::before { content: 'Event: '; color: #999 }
.class::before { content: 'Class: '; color: #999 }
Expand Down
Loading

0 comments on commit 0bb7de5

Please sign in to comment.