slidev-theme-gtlabo 2.2.0 → 2.2.1

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.
@@ -1,8 +1,9 @@
1
1
  <template>
2
- <component
2
+ <component
3
3
  :is="containerTag"
4
- :class="['math-text-container', containerClass]"
5
- :style="eq ? 'position: relative; display: block;' : ''"
4
+ ref="containerRef"
5
+ :class="['math-text-container', containerClass, eq ? 'has-eq-number' : '']"
6
+ :style="eq ? { paddingRight: eqPadding } : {}"
6
7
  >
7
8
  <!-- スロットが使われている場合 -->
8
9
  <template v-if="hasSlotContent">
@@ -124,12 +125,18 @@ const props = defineProps({
124
125
  eq: {
125
126
  type: String,
126
127
  default: null
128
+ },
129
+ eqPadding: {
130
+ type: String,
131
+ default: '2.5em'
127
132
  }
128
133
  })
129
134
 
130
135
  // 数式レジストリ
131
136
  const equationRegistry = inject('equationRegistry', null)
132
137
 
138
+ const containerRef = ref(null)
139
+
133
140
  const eqNumber = computed(() => {
134
141
  if (!props.eq || !equationRegistry) return null
135
142
  return equationRegistry.getNumber(props.eq)
@@ -413,8 +420,8 @@ const renderMathElements = async () => {
413
420
  }
414
421
 
415
422
  onMounted(() => {
416
- if (props.eq && equationRegistry) {
417
- equationRegistry.register(props.eq)
423
+ if (props.eq && equationRegistry && containerRef.value) {
424
+ equationRegistry.register(props.eq, containerRef.value)
418
425
  }
419
426
  renderMathElements()
420
427
  })
@@ -481,6 +488,11 @@ watch([processedTextSegments, processedSlotSegments], () => {
481
488
  border-radius: 3px;
482
489
  }
483
490
 
491
+ .math-text-container.has-eq-number {
492
+ position: relative;
493
+ display: block;
494
+ }
495
+
484
496
  .eq-number {
485
497
  position: absolute;
486
498
  right: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slidev-theme-gtlabo",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "A Slidev theme for laboratory presentations with customizable components",
5
5
  "author": "mksmkss",
6
6
  "license": "MIT",