Skip to content

Commit b307f1c

Browse files
authored
Merge pull request #381 from messenjer/refactor/remove-clientonly-around-script-setup
refactor: remove <ClientOnly> around script setup in .md
2 parents 1b4b79f + 4aae659 commit b307f1c

File tree

9 files changed

+50
-77
lines changed

9 files changed

+50
-77
lines changed

docs/components/Alert.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,6 @@ To create a `<b-alert>` that dismisses automatically after a period of time, set
286286
| `default` | Content to place in the alert |
287287
| ~~`dismiss`~~ | Content for the dismiss button |
288288

289-
<ClientOnly>
290-
291289
<script lang="ts" setup>
292290
import {ref, computed} from 'vue'
293291

@@ -315,5 +313,3 @@ To create a `<b-alert>` that dismisses automatically after a period of time, set
315313
};
316314

317315
</script>
318-
319-
</ClientOnly>

docs/components/Avatar.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,10 +838,10 @@ Avatars are based upon `<b-badge>` and `<b-button>` components, and as such, rel
838838
| --------- | ---------------------------------------------- |
839839
| `default` | Content (avatars) to place in the avatar group |
840840

841-
<!-- <script lang="ts" setup>
841+
<script lang="ts" setup>
842842
import {ref, Ref} from 'vue';
843843

844844
const alertEvent = (event: PointerEvent) => {
845845
alert(`Clicked`);
846846
}
847-
</script> -->
847+
</script>

docs/components/Breadcrumb.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Use slot `prepend` to put content before the breadcrumb. Use slot `append` to pu
172172
| ------- | ----------------------------------- | --------------------------------------- |
173173
| `click` | `event` - Native click event object | Content to place in the breadcrumb item |
174174

175-
<!-- <script lang="ts" setup>
175+
<script lang="ts" setup>
176176
import {ref, Ref} from 'vue';
177177
import {BreadcrumbItem} from '../../src/types';
178178

@@ -187,4 +187,4 @@ Use slot `prepend` to put content before the breadcrumb. Use slot `append` to pu
187187
const alertEvent = (event: PointerEvent) => {
188188
alert(`Event ${event.target}`);
189189
}
190-
</script> -->
190+
</script>

docs/components/Button.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,6 @@ added, nor will the keyboard event listeners be enabled.
409409
| ------- | ------------------------- | ---------------------------------------- |
410410
| `click` | Native click event object | Emitted when non-disabled button clicked |
411411

412-
<ClientOnly>
413-
414412
<script lang='ts' setup>
415413
import {ref, computed} from 'vue'
416414

@@ -424,5 +422,3 @@ added, nor will the keyboard event listeners be enabled.
424422

425423
const btnStates = computed(() => buttons.value.map(b => b.state))
426424
</script>
427-
428-
</ClientOnly>

docs/components/Collapse.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,6 @@ apply those roles for you automatically, as it depends on your final document ma
429429
| `shown` | | Emitted when collapse has finished opening |
430430
| `update:modelValue` | `visible` Will be true if the collapse is visible | Emitted when collapse has finished opening |
431431

432-
<ClientOnly>
433-
434432
<script lang="ts" setup>
435433
import {ref, computed} from 'vue'
436434

@@ -448,8 +446,6 @@ apply those roles for you automatically, as it depends on your final document ma
448446
`
449447
</script>
450448

451-
</ClientOnly>
452-
453449
<style>
454450
.collapsed > .when-open {
455451
display: none;

docs/components/Form.md

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -458,46 +458,6 @@ Refer to the
458458
[Bootstrap v5 Form Validation Documentation](https://getbootstrap.com/docs/5.0/forms/validation/)
459459
for details on the Bootstrap v5 validation states.
460460

461-
<ClientOnly>
462-
463-
<script lang='ts' setup>
464-
import {ref, computed, reactive, nextTick} from 'vue'
465-
466-
const form = reactive({
467-
email: '',
468-
name: '',
469-
food: null,
470-
checked: []
471-
})
472-
473-
const foods = [{ text: 'Select One', value: null }, 'Carrots', 'Beans', 'Tomatoes', 'Corn']
474-
const show = ref(true)
475-
476-
const onSubmit = (event) => {
477-
event.preventDefault()
478-
alert(JSON.stringify(form))
479-
}
480-
481-
const onReset = (event) => {
482-
event.preventDefault()
483-
// Reset our form values
484-
form.email = ''
485-
form.name = ''
486-
form.food = null
487-
form.checked = []
488-
// Trick to reset/clear native browser form validation state
489-
show.value = false
490-
nextTick(() => {
491-
show.value = true
492-
})
493-
}
494-
495-
const userId = ref('')
496-
const validation = computed(()=> userId.value.length > 4 && userId.value.length < 13)
497-
</script>
498-
499-
</ClientOnly>
500-
501461
## Component reference
502462

503463
### `<b-form>`
@@ -584,3 +544,39 @@ for details on the Bootstrap v5 validation states.
584544
| Property | Description |
585545
| --------- | --------------------------------------------------- |
586546
| `default` | Content to place in the form valid feedback element |
547+
548+
<script lang='ts' setup>
549+
import {ref, computed, reactive, nextTick} from 'vue'
550+
551+
const form = reactive({
552+
email: '',
553+
name: '',
554+
food: null,
555+
checked: []
556+
})
557+
558+
const foods = [{ text: 'Select One', value: null }, 'Carrots', 'Beans', 'Tomatoes', 'Corn']
559+
const show = ref(true)
560+
561+
const onSubmit = (event) => {
562+
event.preventDefault()
563+
alert(JSON.stringify(form))
564+
}
565+
566+
const onReset = (event) => {
567+
event.preventDefault()
568+
// Reset our form values
569+
form.email = ''
570+
form.name = ''
571+
form.food = null
572+
form.checked = []
573+
// Trick to reset/clear native browser form validation state
574+
show.value = false
575+
nextTick(() => {
576+
show.value = true
577+
})
578+
}
579+
580+
const userId = ref('')
581+
const validation = computed(()=> userId.value.length > 4 && userId.value.length < 13)
582+
</script>

docs/components/FormCheckbox.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ The indeterminate state is **visual only**. The checkbox is still either checked
741741
<p class="alert alert-warning">
742742
<strong>Caution:</strong> Props that support HTML strings (<code>*-html</code>) can be vulnerable to
743743
<a class="alert-link" href="https://en.wikipedia.org/wiki/Cross-site_scripting">
744-
<abbr title="Cross Site Scripting Attacks">XSS attacks</abbr></a>when passed raw user supplied values. You must properly
744+
<abbr title="Cross Site Scripting Attacks">XSS attacks</abbr></a>when passed raw user supplied values. You must properly
745745
<a class="alert-link" href="https://en.wikipedia.org/wiki/HTML_sanitization">sanitize</a> the user input first!
746746
</p>
747747

@@ -808,8 +808,6 @@ The indeterminate state is **visual only**. The checkbox is still either checked
808808
| `change` | `checked` - Value of checkbox(es). When bound to multiple checkboxes, value will be an array | Emitted when selected value(s) is changed due to user interaction |
809809
| `input` | `checked` - Value of checkbox(es). When bound to multiple checkboxes, value will be an array | Emitted when selected value(s) is changed |
810810

811-
<ClientOnly>
812-
813811
<script lang='ts' setup>
814812
import {ref, computed} from 'vue'
815813

@@ -820,7 +818,7 @@ The indeterminate state is **visual only**. The checkbox is still either checked
820818

821819
const availableCars = ['BMW', 'Mercedes', 'Toyota'];
822820
const selectedCars = ref([]);
823-
821+
824822
const concatSelectedCars = computed(() => { return selectedCars.value.join(', ');});
825823

826824
const checkEx2Selected = ref(['A']);
@@ -856,5 +854,3 @@ The indeterminate state is **visual only**. The checkbox is still either checked
856854
const contextualState = computed(() => contextualSelected.value.length === 2);
857855

858856
</script>
859-
860-
</ClientOnly>

docs/components/Pagination.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ For a full list of all available slots see the [Slots](#comp-ref-b-pagination-sl
7676
</template>
7777
</b-pagination>
7878
Current page : {{ ex1CurrentPage }}
79-
</div>
79+
</div>
8080
</b-card>
8181
</ClientOnly>
8282

@@ -480,8 +480,6 @@ To be done
480480
| `update:modelValue` | `current page` - Value of he current page | |
481481
| `page-click` | `bvEvent ` - The `BvEvent` object. Call `bvEvent.preventDefault()` to cancel page selection | Emitted when a page button was clicked. Cancelable |
482482

483-
<ClientOnly>
484-
485483
<script lang='ts' setup>
486484
import {ref, computed} from 'vue'
487485

@@ -502,5 +500,3 @@ To be done
502500
const ex5CurrentPage = ref(3);
503501
const ex5Rows = ref(100);
504502
</script>
505-
506-
</ClientOnly>

docs/components/Toast.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,20 +134,17 @@ Toasts can be displayed as variants thru various helper methods or be set in `To
134134
<ComponentReference></ComponentReference>
135135
</ClientOnly>
136136

137-
<ClientOnly>
138-
139137
<script lang='ts' setup>
140138
import {ref, computed} from 'vue';
141139
import {useToast} from 'bootstrap-vue-3';
142140

141+
// let toast = useToast()
143142

144-
let show1 = () => {toast.show({title: 'example title'})};
145-
let show2 = () => {toast.show({title: 'example title', body: "This is a toast"}, {variant: 'info'})};
143+
let show1 = () => {toast.show({title: 'example title'})};
144+
let show2 = () => {toast.show({title: 'example title', body: "This is a toast"}, {variant: 'info'})};
146145

147-
let variantshow1 = () => {toast.show({title: 'Item Deleted'}, {pos: 'bottom-center', variant: 'danger'})};
148-
let variantshow2 = () => {toast.show({title: 'New Message', body: "This is a toast"}, {pos: 'bottom-right', variant: 'info'})};
149-
let variantshow3 = () => {toast.show({title: 'Warning for Item', body: "Please check list"},{pos: 'bottom-right', variant: 'warning'})};
150-
let variantshow4 = () => {toast.show({title: 'Event Created!', body: "Bootstrap Event"},{pos: 'bottom-right', variant: 'success'})};
146+
let variantshow1 = () => {toast.show({title: 'Item Deleted'}, {pos: 'bottom-center', variant: 'danger'})};
147+
let variantshow2 = () => {toast.show({title: 'New Message', body: "This is a toast"}, {pos: 'bottom-right', variant: 'info'})};
148+
let variantshow3 = () => {toast.show({title: 'Warning for Item', body: "Please check list"},{pos: 'bottom-right', variant: 'warning'})};
149+
let variantshow4 = () => {toast.show({title: 'Event Created!', body: "Bootstrap Event"},{pos: 'bottom-right', variant: 'success'})};
151150
</script>
152-
153-
</ClientOnly>

0 commit comments

Comments
 (0)