@bagelink/vue 1.21.53 → 1.21.55

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "1.21.53",
4
+ "version": "1.21.55",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
@@ -63,7 +63,7 @@
63
63
  "@types/signature_pad": "^4.0.0",
64
64
  "vue": "^3.5.45",
65
65
  "vue-component-type-helpers": "^2.2.12",
66
- "@bagelink/sdk": "1.21.53"
66
+ "@bagelink/sdk": "1.21.55"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "@bagelink/sdk": "*",
@@ -21,6 +21,8 @@ const props = defineProps({
21
21
  mobileHeight: { type: String, default: undefined },
22
22
  /** Pair with height="auto" for content-sized, capped output. */
23
23
  maxHeight: { type: String, default: undefined },
24
+ /** Floor when height="auto" (content can still grow). CSS length or unitless px. */
25
+ minHeight: { type: String, default: undefined },
24
26
  terminal: { type: Boolean, default: false },
25
27
  title: { type: String, default: '' },
26
28
  disabled: { type: Boolean, default: false },
@@ -33,9 +35,10 @@ const props = defineProps({
33
35
  formatting: { type: Boolean, default: false },
34
36
  /**
35
37
  * Toolbar chrome: `bar` keeps language + actions above the editor;
36
- * `hover` reveals them on hover/focus. Terminal mode always uses the title bar.
38
+ * `hover` reveals them on hover/focus; `none` hides chrome entirely.
39
+ * Terminal mode always uses the title bar.
37
40
  */
38
- toolbarMode: { type: String as PropType<'bar' | 'hover'>, default: 'bar' },
41
+ toolbarMode: { type: String as PropType<'bar' | 'hover' | 'none'>, default: 'bar' },
39
42
  singleLine: { type: Boolean, default: false },
40
43
  /** Legacy highlight.js theme names now map to light/dark appearance. */
41
44
  theme: { type: String as PropType<HighlightTheme>, default: 'dark' },
@@ -58,11 +61,17 @@ const isFocused = ref(false)
58
61
  const hasCodeValue = computed(() => Boolean(code.value?.trim()))
59
62
  // Preserve object mode through temporarily invalid JSON while editing.
60
63
  const objectMode = ref(typeof props.modelValue === 'object')
64
+ function cssLength(value: string | undefined): string | undefined {
65
+ if (value === undefined || value === '') return undefined
66
+ return /^\d+$/.test(value) ? `${value}px` : value
67
+ }
61
68
  const editorHeight = computed(() => {
62
69
  if (props.singleLine) return undefined
63
70
  const height = isMobile.value && props.mobileHeight !== undefined ? props.mobileHeight : props.height
64
- return /^\d+$/.test(height) ? `${height}px` : height
71
+ return cssLength(height)
65
72
  })
73
+ const editorMaxHeight = computed(() => cssLength(props.maxHeight))
74
+ const editorMinHeight = computed(() => cssLength(props.minHeight))
66
75
  const isLightTheme = computed(() => {
67
76
  const theme = String(props.theme).toLowerCase()
68
77
  if (theme.includes('dark')) return false
@@ -105,7 +114,12 @@ watch(() => props.modelValue, value => {
105
114
  <div
106
115
  class="bagel-input code-editor-container ltr display-flex flex-column"
107
116
  :class="[shellClass, { 'has-value': hasCodeValue, 'single-line': singleLine, terminal }]"
108
- :style="[{ height: editorHeight, '--code-max-height': maxHeight }, shellStyle]"
117
+ :style="[{
118
+ height: editorHeight,
119
+ minHeight: editorMinHeight,
120
+ '--code-max-height': editorMaxHeight,
121
+ '--code-min-height': editorMinHeight,
122
+ }, shellStyle]"
109
123
  >
110
124
  <!-- Bar mode puts the form label on the toolbar row; other modes keep it above. -->
111
125
  <label v-if="label && (toolbarMode === 'hover' || singleLine || terminal)" class="label">{{ label }}</label>
@@ -30,9 +30,10 @@ const props = defineProps<{
30
30
  /**
31
31
  * `bar` (default) — language label + actions always visible above the editor.
32
32
  * `hover` — immersive surface; chrome appears on hover/focus.
33
+ * `none` — no chrome (e.g. when the parent already provides copy actions).
33
34
  * Terminal mode always uses the title-bar row for chrome.
34
35
  */
35
- toolbarMode?: 'bar' | 'hover'
36
+ toolbarMode?: 'bar' | 'hover' | 'none'
36
37
  }>()
37
38
  const emit = defineEmits<{
38
39
  'update:modelValue': [value: string]
@@ -52,7 +53,7 @@ const canFormat = computed(() => props.formatting && !props.singleLine && suppor
52
53
  const toolbarMode = computed(() => props.toolbarMode ?? 'bar')
53
54
  const hoverToolbar = computed(() => !props.terminal && toolbarMode.value === 'hover')
54
55
  const toolbarPinned = computed(() => formattingBusy.value || copied.value || Boolean(formatError.value || copyError.value))
55
- const showToolbar = computed(() => !props.singleLine)
56
+ const showToolbar = computed(() => !props.singleLine && toolbarMode.value !== 'none')
56
57
  const config = new Compartment()
57
58
  const languageConfig = new Compartment()
58
59
  const externalUpdate = Annotation.define<boolean>()
@@ -107,7 +108,8 @@ function createSearchPanel(editor: EditorView) {
107
108
  }
108
109
 
109
110
  function extensions(): Extension[] {
110
- const contentPad = props.singleLine ? '0' : '0.75em 1ch 1.5em 2ch'
111
+ // Match `.bagel-input` field padding (inputs.css) — keep sides even.
112
+ const contentPad = props.singleLine ? '0' : '0.7rem'
111
113
  return [
112
114
  props.dark ? atomone : atomLight,
113
115
  props.lineNumbers && !props.singleLine ? numberGutter() : [],
@@ -290,6 +292,7 @@ onBeforeUnmount(() => {
290
292
  terminal,
291
293
  'toolbar-hover': hoverToolbar,
292
294
  'toolbar-pinned': toolbarPinned,
295
+ 'toolbar-none': toolbarMode === 'none',
293
296
  'single-line': singleLine,
294
297
  }"
295
298
  >
@@ -361,7 +364,7 @@ onBeforeUnmount(() => {
361
364
  width: 100%;
362
365
  height: 100%;
363
366
  min-width: 0;
364
- min-height: 0;
367
+ min-height: var(--code-min-height, 0);
365
368
  max-height: var(--code-max-height, none);
366
369
  overflow: hidden;
367
370
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
@@ -382,15 +385,13 @@ onBeforeUnmount(() => {
382
385
  }
383
386
  /* Bar mode: chrome (label/language/actions) sits above; the code surface is the rounded input. */
384
387
  .structured-editor:not(.toolbar-hover):not(.terminal):not(.single-line) .structured-editor-host {
385
- border-radius: var(--code-border-radius, 0.25rem);
388
+ border-radius: var(--bgl-input-border-radius);
386
389
  overflow: hidden;
387
390
  }
388
- /* Hover / single-line: round the whole editor shell (chrome overlays or is absent). */
391
+ /* Hover / single-line / no-toolbar: round the whole editor shell. */
389
392
  .toolbar-hover,
390
- .structured-editor.single-line {
391
- border-radius: var(--code-border-radius, 0.25rem);
392
- }
393
- .structured-editor.single-line {
393
+ .structured-editor.single-line,
394
+ .structured-editor.toolbar-none {
394
395
  border-radius: var(--bgl-input-border-radius);
395
396
  }
396
397
  /* Single-line inputs: allow sideways scroll only — never a vertical scrollbar. */