@appscode/design-system 0.0.21-alpha.2 → 0.4.27

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.
Files changed (165) hide show
  1. package/base/utilities/_all.scss +7 -0
  2. package/base/utilities/_customize-bulma.scss +191 -0
  3. package/base/utilities/_default.scss +319 -110
  4. package/base/utilities/_derived-variables.scss +8 -15
  5. package/base/utilities/_grid.scss +29 -0
  6. package/base/utilities/_initial-variables.scss +111 -72
  7. package/base/utilities/_mixin.scss +90 -10
  8. package/base/utilities/_typography.scss +29 -19
  9. package/base/utilities/dark-theme.scss +26 -0
  10. package/components/_ac-accordion.scss +15 -5
  11. package/components/_ac-alert-box.scss +109 -26
  12. package/components/_ac-card.scss +71 -24
  13. package/components/_ac-code-highlight.scss +7 -1
  14. package/components/_ac-content-layout.scss +5 -5
  15. package/components/_ac-drag.scss +8 -6
  16. package/components/_ac-input.scss +196 -38
  17. package/components/_ac-modal.scss +6 -5
  18. package/components/_ac-multi-select.scss +281 -23
  19. package/components/_ac-options.scss +31 -16
  20. package/components/_ac-report.scss +53 -0
  21. package/components/_ac-select-box.scss +15 -5
  22. package/components/_ac-table.scss +160 -39
  23. package/components/_ac-tabs.scss +86 -23
  24. package/components/_ac-tags.scss +87 -2
  25. package/components/_ac-terminal.scss +270 -0
  26. package/components/_all.scss +28 -0
  27. package/components/_app-drawer.scss +134 -0
  28. package/components/_breadcumb.scss +8 -3
  29. package/components/_buttons.scss +96 -62
  30. package/components/_card-body-wrapper.scss +3 -3
  31. package/components/_dashboard-header.scss +33 -1
  32. package/components/_direct-deploy.scss +69 -0
  33. package/components/_go-to-top.scss +1 -1
  34. package/components/_graph.scss +45 -0
  35. package/components/_image-upload.scss +6 -4
  36. package/components/_left-sidebar-menu.scss +212 -52
  37. package/components/_monaco-editor.scss +1 -1
  38. package/components/_navbar.scss +193 -31
  39. package/components/_overview-info.scss +4 -4
  40. package/components/_overview-page.scss +1 -2
  41. package/components/_pagination.scss +45 -7
  42. package/components/_payment-card.scss +28 -12
  43. package/components/_preloader.scss +1 -1
  44. package/components/_preview-modal.scss +22 -9
  45. package/components/_pricing-table.scss +1 -1
  46. package/components/_progress-bar.scss +5 -5
  47. package/components/_subscription-card.scss +15 -8
  48. package/components/_table-of-content.scss +1 -1
  49. package/components/_tfa.scss +69 -0
  50. package/components/_transitions.scss +261 -0
  51. package/components/_widget-menu.scss +9 -9
  52. package/components/_wizard.scss +33 -20
  53. package/components/ac-toaster/_ac-toasted.scss +40 -8
  54. package/components/bbum/_all.scss +9 -0
  55. package/components/bbum/_card-team.scss +18 -10
  56. package/components/bbum/_information-center.scss +19 -5
  57. package/components/bbum/_mobile-desktop.scss +6 -6
  58. package/components/bbum/_post.scss +5 -4
  59. package/components/bbum/_sign-up-notification.scss +6 -6
  60. package/components/bbum/_single-post-preview.scss +10 -10
  61. package/components/bbum/_user-profile.scss +97 -90
  62. package/components/ui-builder/_ui-builder.scss +98 -21
  63. package/components/ui-builder/_vue-open-api.scss +104 -0
  64. package/layouts/_404.scss +159 -0
  65. package/layouts/_all.scss +2 -0
  66. package/layouts/_code-preview.scss +19 -8
  67. package/main.scss +6 -53
  68. package/package.json +4 -7
  69. package/plugins/caching.ts +243 -0
  70. package/plugins/theme.js +142 -0
  71. package/plugins/time-convert.js +49 -0
  72. package/plugins/vue-toaster.js +10 -6
  73. package/vue-components/v2/banner/Banner.vue +2 -2
  74. package/vue-components/v2/breadcrumbs/Breadcrumb.vue +97 -0
  75. package/vue-components/v2/button/Button.vue +10 -1
  76. package/vue-components/v2/button/DownloadBtn.vue +45 -0
  77. package/vue-components/v2/card/Card.vue +1 -0
  78. package/vue-components/v2/card/CardContent.vue +5 -0
  79. package/vue-components/v2/card/CardHeader.vue +12 -0
  80. package/vue-components/v2/card/OverviewCard.vue +10 -0
  81. package/vue-components/v2/card/OverviewCards.vue +5 -0
  82. package/vue-components/v2/card/PaymentCard.vue +69 -0
  83. package/vue-components/v2/card/PaymentCardOptionButtons.vue +35 -0
  84. package/vue-components/v2/card/PaymentCards.vue +44 -0
  85. package/vue-components/v2/content/ContentHeader.vue +9 -5
  86. package/vue-components/v2/content/ContentTable.vue +12 -7
  87. package/vue-components/v2/editor/Editor.vue +38 -5
  88. package/vue-components/v2/editor/FilteredFileEditor.vue +189 -0
  89. package/vue-components/v2/editor/MonacoEditor.vue +125 -0
  90. package/vue-components/v2/editor/ResourceKeyValueEditor.vue +209 -0
  91. package/vue-components/v2/form/Form.vue +12 -7
  92. package/vue-components/v2/form-fields/Input.vue +1 -1
  93. package/vue-components/v2/header/Header.vue +0 -1
  94. package/vue-components/v2/loaders/ResourceLoader.vue +101 -0
  95. package/vue-components/v2/loaders/SidebarLoader.vue +43 -0
  96. package/vue-components/v2/modal/Modal.vue +40 -7
  97. package/vue-components/v2/modals/DeleteConfirmationModal.vue +79 -0
  98. package/vue-components/v2/modals/JsonShowModal.vue +12 -3
  99. package/vue-components/v2/navbar/Appdrawer.vue +10 -9
  100. package/vue-components/v2/navbar/ThemeMode.vue +120 -0
  101. package/vue-components/v2/navbar/User.vue +229 -17
  102. package/vue-components/v2/notification/Notification.vue +101 -0
  103. package/vue-components/v2/notification/NotificationItem.vue +44 -0
  104. package/vue-components/v2/pagination/Pagination.vue +24 -4
  105. package/vue-components/v2/preloader/Preloader.vue +5 -5
  106. package/vue-components/v2/sidebar/ClusterSwitcher.vue +126 -0
  107. package/vue-components/v2/sidebar/SidebarItem.vue +24 -2
  108. package/vue-components/v2/sidebar/SidebarItemWithDropDown.vue +19 -20
  109. package/vue-components/v2/tab/TabItem.vue +1 -1
  110. package/vue-components/v2/table/FakeTableCell.vue +36 -0
  111. package/vue-components/v2/table/InfoTable.vue +13 -3
  112. package/vue-components/v2/table/NarrowTable.vue +0 -2
  113. package/vue-components/v2/table/Table.vue +170 -10
  114. package/vue-components/v2/table/TableRow.vue +29 -2
  115. package/vue-components/v2/table/table-cell/CellValue.vue +33 -4
  116. package/vue-components/v2/table/table-cell/GenericCell.vue +56 -0
  117. package/vue-components/v2/table/table-cell/ObjectCell.vue +4 -1
  118. package/vue-components/v2/tabs/EditorTabs.vue +1 -1
  119. package/vue-components/v3/button/Button.vue +78 -0
  120. package/vue-components/v3/content/ContentHeader.vue +55 -0
  121. package/vue-components/v3/content/ContentTable.vue +83 -0
  122. package/vue-components/v3/dropdown/DropdownDivider.vue +3 -0
  123. package/vue-components/v3/dropdown/DropdownItem.vue +5 -0
  124. package/vue-components/v3/dropdown/DropdownMenu.vue +111 -0
  125. package/vue-components/v3/editor/Editor.vue +160 -0
  126. package/vue-components/v3/editor/FilteredFileEditor.vue +186 -0
  127. package/vue-components/v3/editor/MonacoEditor.vue +131 -0
  128. package/vue-components/v3/editor/ResourceKeyValueEditor.vue +125 -0
  129. package/vue-components/v3/form/Form.vue +63 -0
  130. package/vue-components/v3/form-fields/Input.vue +22 -0
  131. package/vue-components/v3/header/Header.vue +45 -0
  132. package/vue-components/v3/header/HeaderItem.vue +5 -0
  133. package/vue-components/v3/header/HeaderItems.vue +5 -0
  134. package/vue-components/v3/loaders/ResourceLoader.vue +83 -0
  135. package/vue-components/v3/loaders/SidebarLoader.vue +34 -0
  136. package/vue-components/v3/long-running-tasks/LongRunningTaskItem.vue +92 -0
  137. package/vue-components/v3/modal/Modal.vue +158 -0
  138. package/vue-components/v3/modals/DeleteConfirmationModal.vue +85 -0
  139. package/vue-components/v3/modals/JsonShowModal.vue +96 -0
  140. package/vue-components/v3/modals/LongRunningTasksModal.vue +373 -0
  141. package/vue-components/v3/navbar/Appdrawer.vue +63 -0
  142. package/vue-components/v3/navbar/ThemeMode.vue +120 -0
  143. package/vue-components/v3/navbar/User.vue +288 -0
  144. package/vue-components/v3/notification/Notification.vue +98 -0
  145. package/vue-components/v3/notification/NotificationItem.vue +52 -0
  146. package/vue-components/v3/pagination/Pagination.vue +172 -0
  147. package/vue-components/v3/searchbars/SearchBar.vue +47 -0
  148. package/vue-components/v3/sidebar/ClusterSwitcher.vue +133 -0
  149. package/vue-components/v3/sidebar/SidebarItemWithDropDown.vue +120 -0
  150. package/vue-components/v3/tab/TabItem.vue +17 -0
  151. package/vue-components/v3/table/FakeTableCell.vue +39 -0
  152. package/vue-components/v3/table/InfoTable.vue +105 -0
  153. package/vue-components/v3/table/MultiInfoTable.vue +143 -0
  154. package/vue-components/v3/table/Table.vue +272 -0
  155. package/vue-components/v3/table/TableCell.vue +28 -0
  156. package/vue-components/v3/table/TableContainer.vue +34 -0
  157. package/vue-components/v3/table/TableRow.vue +147 -0
  158. package/vue-components/v3/table/table-cell/ArrayCell.vue +111 -0
  159. package/vue-components/v3/table/table-cell/CellValue.vue +133 -0
  160. package/vue-components/v3/table/table-cell/GenericCell.vue +75 -0
  161. package/vue-components/v3/table/table-cell/ObjectCell.vue +110 -0
  162. package/vue-components/v3/table/table-cell/ValueWithModal.vue +43 -0
  163. package/vue-components/v3/tabs/EditorTabs.vue +36 -0
  164. package/vue-components/v3/tag/Tag.vue +17 -0
  165. package/vue-components/v3/terminal/LongRunningTaskTerminal.vue +148 -0
@@ -0,0 +1,111 @@
1
+ <template>
2
+ <tags v-if="printableStringObjs.length">
3
+ <tag
4
+ v-for="(printableStringOb, idx) in printableStringObjs.slice(
5
+ 0,
6
+ indexOfCharacterLengthExceed
7
+ )"
8
+ :key="`${printableStringOb.print}-${idx}`"
9
+ >
10
+ <value-with-modal
11
+ v-if="printableStringOb.exceededLength"
12
+ :title="`${cellTitle}: ${idx}`"
13
+ :value="printableStringOb.value"
14
+ :print="printableStringOb.print"
15
+ />
16
+ <template v-else> {{ printableStringOb.print }} </template>
17
+ </tag>
18
+
19
+ <tag v-if="indexOfCharacterLengthExceed !== printableStringObjs.length">
20
+ <a @click.prevent.stop="showFullData = true">
21
+ <ellipsis-icon />
22
+ <json-show-modal
23
+ :open="showFullData"
24
+ @closemodal="showFullData = false"
25
+ :editor-title="cellTitle"
26
+ :editor-content="items"
27
+ />
28
+ </a>
29
+ </tag>
30
+ </tags>
31
+ <p v-else>-</p>
32
+ </template>
33
+
34
+ <script>
35
+ import { defineComponent, defineAsyncComponent } from "vue";
36
+
37
+ export default defineComponent({
38
+ props: {
39
+ cellTitle: {
40
+ type: String,
41
+ default: "Array",
42
+ },
43
+ items: {
44
+ type: Array,
45
+ default: () => [],
46
+ },
47
+ maxCharacterLength: {
48
+ type: Number,
49
+ default: undefined,
50
+ },
51
+ },
52
+ components: {
53
+ Tags: defineAsyncComponent(() =>
54
+ import("../../../v2/tag/Tags.vue").then((module) => module.default)
55
+ ),
56
+ Tag: defineAsyncComponent(() =>
57
+ import("../../tag/Tag.vue").then((module) => module.default)
58
+ ),
59
+ EllipsisIcon: defineAsyncComponent(() =>
60
+ import("../../../v2/icons/Ellipsis.vue").then((module) => module.default)
61
+ ),
62
+ JsonShowModal: defineAsyncComponent(() =>
63
+ import("../../modals/JsonShowModal.vue").then((module) => module.default)
64
+ ),
65
+ ValueWithModal: defineAsyncComponent(() =>
66
+ import("./ValueWithModal.vue").then((module) => module.default)
67
+ ),
68
+ },
69
+
70
+ data() {
71
+ return {
72
+ showFullData: false,
73
+ };
74
+ },
75
+
76
+ computed: {
77
+ printableStringObjs() {
78
+ return this.items.map((item) => {
79
+ const value = item;
80
+ let exceededLength = false;
81
+ let print = item;
82
+ if (typeof item === "object") {
83
+ exceededLength = true;
84
+ print = item["Name"] || item["name"] || item[Object.keys(item)[0]];
85
+ } else {
86
+ const stringifiedValue = JSON.stringify(item);
87
+ exceededLength = stringifiedValue.length > 27;
88
+ print = exceededLength
89
+ ? `${stringifiedValue.slice(0, 27)}...`
90
+ : stringifiedValue;
91
+ }
92
+ return { value, exceededLength, print };
93
+ });
94
+ },
95
+ indexOfCharacterLengthExceed() {
96
+ let idx = -1;
97
+ let cumulativeLen = 0;
98
+ for (const [index, po] of this.printableStringObjs.entries()) {
99
+ const newLen = cumulativeLen + po.print.length;
100
+ if (newLen > this.maxCharacterLength) {
101
+ idx = index;
102
+ break;
103
+ }
104
+ cumulativeLen = newLen;
105
+ }
106
+
107
+ return idx === -1 ? this.printableStringObjs.length : idx;
108
+ },
109
+ },
110
+ });
111
+ </script>
@@ -0,0 +1,133 @@
1
+ <template>
2
+ <div v-if="isLoaderActive" ref="cellLoaderDiv" :style="{ maxWidth: '300px' }">
3
+ <content-loader
4
+ :view-box="`0 0 ${computedCellWidth || 300} 10`"
5
+ :speed="2"
6
+ :key="computedCellWidth"
7
+ :primaryColor="primaryColor"
8
+ :secondaryColor="secondaryColor"
9
+ />
10
+ </div>
11
+ <div v-else ref="cellDiv">
12
+ <object-cell
13
+ v-if="valueType === 'object'"
14
+ :obj="value"
15
+ :cell-title="cellTitle"
16
+ :max-character-length="maxCharacterLength"
17
+ data-testid="object-cell-value"
18
+ />
19
+ <array-cell
20
+ v-else-if="valueType === 'array'"
21
+ :items="value"
22
+ :cell-title="cellTitle"
23
+ :max-character-length="maxCharacterLength"
24
+ data-testid="array-cell-value"
25
+ />
26
+ <template v-else>
27
+ <span class="is-ellipsis-1" :title="tooltip" data-testid="cell-value">{{
28
+ value || (value === 0 ? 0 : "-")
29
+ }}</span>
30
+ </template>
31
+ </div>
32
+ </template>
33
+
34
+ <script>
35
+ import { defineComponent, defineAsyncComponent } from "vue";
36
+ import {
37
+ loaderLightThemePrimaryColor,
38
+ loaderDarkThemePrimaryColor,
39
+ loaderLightThemeSecondaryColor,
40
+ loaderDarkThemeSecondaryColor,
41
+ } from "@appscode/design-system/plugins/theme";
42
+
43
+ export default defineComponent({
44
+ props: {
45
+ isLoaderActive: {
46
+ type: Boolean,
47
+ default: false,
48
+ },
49
+ cellTitle: {
50
+ type: String,
51
+ default: "Cell",
52
+ },
53
+ value: {
54
+ type: null,
55
+ default: "",
56
+ },
57
+ tooltip: {
58
+ type: String,
59
+ defualt: "",
60
+ },
61
+ },
62
+ components: {
63
+ ContentLoader: defineAsyncComponent(() =>
64
+ import("vue-content-loader").then(({ ContentLoader }) => ContentLoader)
65
+ ),
66
+ ObjectCell: defineAsyncComponent(() =>
67
+ import("./ObjectCell.vue").then((module) => module.default)
68
+ ),
69
+ ArrayCell: defineAsyncComponent(() =>
70
+ import("./ArrayCell.vue").then((module) => module.default)
71
+ ),
72
+ },
73
+
74
+ computed: {
75
+ valueType() {
76
+ if (typeof this.value === "object") {
77
+ if (this.value === null) return "null";
78
+ else if (Array.isArray(this.value)) return "array";
79
+ else return "object";
80
+ } else return typeof this.value;
81
+ },
82
+ maxCharacterLength() {
83
+ return Math.ceil(this.computedCellWidth / 8);
84
+ },
85
+ primaryColor() {
86
+ return document.documentElement.classList.contains("is-dark-theme")
87
+ ? loaderDarkThemePrimaryColor
88
+ : loaderLightThemePrimaryColor;
89
+ },
90
+ secondaryColor() {
91
+ return document.documentElement.classList.contains("is-dark-theme")
92
+ ? loaderDarkThemeSecondaryColor
93
+ : loaderLightThemeSecondaryColor;
94
+ },
95
+ },
96
+
97
+ data() {
98
+ return {
99
+ computedCellWidth: null,
100
+ };
101
+ },
102
+
103
+ mounted() {
104
+ this.calcCellWidth();
105
+ },
106
+
107
+ watch: {
108
+ isLoaderActive() {
109
+ this.calcCellWidth();
110
+ },
111
+ },
112
+
113
+ methods: {
114
+ calcCellWidth() {
115
+ if (this.isLoaderActive) {
116
+ this.$nextTick(() => {
117
+ const cellLoaderDiv = this.$refs.cellLoaderDiv;
118
+ if (cellLoaderDiv) {
119
+ this.computedCellWidth = cellLoaderDiv.offsetWidth;
120
+ }
121
+ });
122
+ } else {
123
+ this.$nextTick(() => {
124
+ const cellDiv = this.$refs.cellDiv;
125
+ if (cellDiv) {
126
+ this.computedCellWidth = cellDiv.offsetWidth;
127
+ }
128
+ });
129
+ }
130
+ },
131
+ },
132
+ });
133
+ </script>
@@ -0,0 +1,75 @@
1
+ <template>
2
+ <span
3
+ :class="{
4
+ 'is-flex': cellDescriptor.type !== 'object',
5
+ 'is-align-items-center': cellValue.icon,
6
+ 'is-justify-content-center': cellDescriptor.textAlign === 'center',
7
+ 'is-justify-content-left': cellDescriptor.textAlign === 'left',
8
+ 'is-justify-content-right': cellDescriptor.textAlign === 'right',
9
+ }"
10
+ >
11
+ <span v-if="cellValue.icon" class="icon p-0 mr-10">
12
+ <img width="15" :src="cellValue.icon" />
13
+ </span>
14
+ <a
15
+ v-if="cellValue.link && cellValue.link.startsWith('http')"
16
+ :href="getCellLink(cellValue)"
17
+ @click.prevent="redirectTo"
18
+ >
19
+ {{ cellValue.data }}
20
+ </a>
21
+ <router-link v-else-if="cellValue.link" :to="getCellLink(cellValue)">
22
+ {{ cellValue.data }}
23
+ </router-link>
24
+ <tag v-else-if="cellValue.color" :class="`is-${cellValue.color}`">
25
+ {{ cellValue.data }}
26
+ </tag>
27
+ <cell-value
28
+ v-else
29
+ :cell-title="cellDescriptor.name"
30
+ :value="cellValue.data || '-'"
31
+ :tooltip="cellValue.tooltip || JSON.stringify(cellValue.data)"
32
+ />
33
+ </span>
34
+ </template>
35
+
36
+ <script>
37
+ import { defineAsyncComponent, defineComponent } from "vue";
38
+ import { useRoute } from "vue-router";
39
+
40
+ export default defineComponent({
41
+ components: {
42
+ Tag: defineAsyncComponent(() => import("../../tag/Tag.vue")),
43
+ CellValue: defineAsyncComponent(() =>
44
+ import("../table-cell/CellValue.vue")
45
+ ),
46
+ },
47
+ props: {
48
+ cellDescriptor: {
49
+ type: Object,
50
+ default: () => ({}),
51
+ },
52
+ cellValue: {
53
+ type: Object,
54
+ default: () => ({}),
55
+ },
56
+ },
57
+ setup() {
58
+ const route = useRoute();
59
+ function getCellLink(cell) {
60
+ const inject = (str, obj) => str.replace(/\${(.*?)}/g, (x, g) => obj[g]);
61
+ const { user, cluster } = route.params;
62
+ const link = inject(cell.link || "", {
63
+ username: user,
64
+ clustername: cluster,
65
+ });
66
+ return link;
67
+ }
68
+ function redirectTo() {
69
+ const link = getCellLink(this.cellValue);
70
+ window.open(link, "_blank");
71
+ }
72
+ return { getCellLink, redirectTo };
73
+ },
74
+ });
75
+ </script>
@@ -0,0 +1,110 @@
1
+ <template>
2
+ <tags v-if="printableStringObjs.length">
3
+ <tag
4
+ v-for="printableStringOb in printableStringObjs.slice(
5
+ 0,
6
+ indexOfCharacterLengthExceed
7
+ )"
8
+ :key="printableStringOb.key"
9
+ modifierClasses="is-info is-light"
10
+ >
11
+ <value-with-modal
12
+ v-if="printableStringOb.exceededLength"
13
+ :title="printableStringOb.key"
14
+ :value="printableStringOb.value"
15
+ :print="printableStringOb.print"
16
+ />
17
+ <template v-else> {{ printableStringOb.print }} </template>
18
+ </tag>
19
+
20
+ <tag modifierClasses="is-info is-light" v-if="indexOfCharacterLengthExceed !== printableStringObjs.length">
21
+ <a @click.prevent.stop="showFullData = true">
22
+ <ellipsis-icon />
23
+ <json-show-modal
24
+ :open="showFullData"
25
+ @closemodal="showFullData = false"
26
+ :editor-title="cellTitle"
27
+ :editor-content="obj"
28
+ />
29
+ </a>
30
+ </tag>
31
+ </tags>
32
+ <p v-else>-</p>
33
+ </template>
34
+
35
+ <script>
36
+ import { defineComponent, defineAsyncComponent } from "vue";
37
+
38
+ export default defineComponent({
39
+ props: {
40
+ cellTitle: {
41
+ type: String,
42
+ default: "Object",
43
+ },
44
+ obj: {
45
+ type: Object,
46
+ default: () => ({}),
47
+ },
48
+ maxCharacterLength: {
49
+ type: Number,
50
+ default: undefined,
51
+ },
52
+ },
53
+ components: {
54
+ Tags: defineAsyncComponent(() =>
55
+ import("../../../v2/tag/Tags.vue").then((module) => module.default)
56
+ ),
57
+ Tag: defineAsyncComponent(() =>
58
+ import("../../tag/Tag.vue").then((module) => module.default)
59
+ ),
60
+ EllipsisIcon: defineAsyncComponent(() =>
61
+ import("../../../v2/icons/Ellipsis.vue").then((module) => module.default)
62
+ ),
63
+ JsonShowModal: defineAsyncComponent(() =>
64
+ import("../../modals/JsonShowModal.vue").then((module) => module.default)
65
+ ),
66
+ ValueWithModal: defineAsyncComponent(() =>
67
+ import("./ValueWithModal.vue").then((module) => module.default)
68
+ ),
69
+ },
70
+
71
+ data() {
72
+ return {
73
+ showFullData: false,
74
+ };
75
+ },
76
+
77
+ computed: {
78
+ objKeys() {
79
+ return Object.keys(this.obj) || [];
80
+ },
81
+ printableStringObjs() {
82
+ return this.objKeys.map((key) => {
83
+ let value = this.obj[key];
84
+ if (typeof value === "object" && value !== null) {
85
+ value = JSON.stringify(value);
86
+ }
87
+ const keyValue = `${key}: ${value}`;
88
+ const exceededLength = keyValue.length > 30;
89
+ const print = exceededLength ? key : keyValue;
90
+ return { key, value, keyValue, exceededLength, print };
91
+ });
92
+ },
93
+ indexOfCharacterLengthExceed() {
94
+ let idx = -1;
95
+ let cumulativeLen = 0;
96
+ for (const [index, po] of this.printableStringObjs.entries()) {
97
+ const newLen = cumulativeLen + po.print.length;
98
+ if (newLen > this.maxCharacterLength) {
99
+ idx = index;
100
+ break;
101
+ }
102
+ cumulativeLen = newLen;
103
+ }
104
+
105
+ return idx === -1 ? this.printableStringObjs.length : idx;
106
+ },
107
+ },
108
+ });
109
+ </script>
110
+
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <a @click.prevent.stop="showModal = true">
3
+ {{ print }}
4
+
5
+ <json-show-modal
6
+ :open="showModal"
7
+ @closemodal="showModal = false"
8
+ :editor-title="title"
9
+ :editor-content="value"
10
+ />
11
+ </a>
12
+ </template>
13
+
14
+ <script>
15
+ import { defineComponent, defineAsyncComponent } from "vue";
16
+
17
+ export default defineComponent({
18
+ props: {
19
+ title: {
20
+ type: String,
21
+ default: "",
22
+ },
23
+ value: {
24
+ type: null,
25
+ default: "",
26
+ },
27
+ print: {
28
+ type: String,
29
+ default: "",
30
+ },
31
+ },
32
+ components: {
33
+ JsonShowModal: defineAsyncComponent(() =>
34
+ import("../../modals/JsonShowModal.vue").then((module) => module.default)
35
+ ),
36
+ },
37
+ data() {
38
+ return {
39
+ showModal: false,
40
+ };
41
+ },
42
+ });
43
+ </script>
@@ -0,0 +1,36 @@
1
+ <template>
2
+ <tabs-body class="mt-10">
3
+ <tabs class="is-line">
4
+ <tab-item :is-active="activeTab === 'edit'">
5
+ <a @click.prevent="$emit('tabchange', 'edit')">Edit</a>
6
+ </tab-item>
7
+ <tab-item :is-active="activeTab === 'preview'">
8
+ <a @click.prevent="$emit('tabchange', 'preview')">Preview Changes</a>
9
+ </tab-item>
10
+ </tabs>
11
+ </tabs-body>
12
+ </template>
13
+
14
+ <script>
15
+ import { defineComponent, defineAsyncComponent } from "vue";
16
+ export default defineComponent({
17
+ props: {
18
+ activeTab: {
19
+ type: String,
20
+ default: "",
21
+ },
22
+ },
23
+ emits: ["tabchange"],
24
+ components: {
25
+ TabsBody: defineAsyncComponent(() =>
26
+ import("../../v2/tab/TabsBody.vue").then((module) => module.default)
27
+ ),
28
+ Tabs: defineAsyncComponent(() =>
29
+ import("../../v2/tab/Tabs.vue").then((module) => module.default)
30
+ ),
31
+ TabItem: defineAsyncComponent(() =>
32
+ import("../tab/TabItem.vue").then((module) => module.default)
33
+ ),
34
+ },
35
+ });
36
+ </script>
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <div class="tag" :class="modifierClasses">
3
+ <slot />
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ import { defineComponent } from "vue";
9
+ export default defineComponent({
10
+ props: {
11
+ modifierClasses: {
12
+ type: String,
13
+ default: "",
14
+ },
15
+ },
16
+ });
17
+ </script>
@@ -0,0 +1,148 @@
1
+ <template>
2
+ <div ref="terminalRef" class="terminal-body"></div>
3
+ </template>
4
+
5
+ <script setup lang="ts">
6
+ import { computed, nextTick, ref, toRefs, watch, watchPostEffect } from "vue";
7
+ import { Terminal } from "xterm";
8
+ import { FitAddon } from "xterm-addon-fit";
9
+ import { WebglAddon } from "xterm-addon-webgl";
10
+ import { Material, MaterialDark } from "xterm-theme"; //https://github.com/ysk2014/xterm-theme/tree/master/src/iterm
11
+
12
+ const props = withDefaults(
13
+ defineProps<{
14
+ theme: string;
15
+ logs: string[];
16
+ }>(),
17
+ { theme: "light", logs: () => [] }
18
+ );
19
+ // terminal print logic
20
+ const { logs, theme } = toRefs(props);
21
+ const lastPrintIdx = ref(0);
22
+ watch(
23
+ logs,
24
+ (n) => {
25
+ if (n.length > lastPrintIdx.value) {
26
+ nextTick(() => {
27
+ writeOnTerminal(n.slice(lastPrintIdx.value).join("\n"));
28
+ lastPrintIdx.value = n.length;
29
+ });
30
+ }
31
+ },
32
+ { immediate: true, deep: true }
33
+ );
34
+
35
+ //theme
36
+ const bodyBgc = computed(() =>
37
+ theme.value === "light" ? "#eaeaea" : "#232322"
38
+ );
39
+
40
+ // xterm component logic
41
+ const terminalRef = ref<HTMLElement>();
42
+ const terminal = new Terminal({
43
+ windowsMode: false,
44
+ theme: theme.value === "light" ? Material : MaterialDark,
45
+ });
46
+ const fitAddon = new FitAddon();
47
+ terminal.loadAddon(fitAddon);
48
+ const webGlAddon = new WebglAddon();
49
+ webGlAddon.onContextLoss(() => {
50
+ webGlAddon.dispose();
51
+ });
52
+ watchPostEffect(() => {
53
+ if (terminalRef.value) {
54
+ terminal.open(terminalRef.value);
55
+ fitAddon.fit();
56
+ terminal.focus();
57
+ terminal.loadAddon(webGlAddon);
58
+ }
59
+ });
60
+ function writeOnTerminal(msg: string) {
61
+ const lines = msg.split("\n");
62
+ lines.forEach((line, index) => {
63
+ if (lines.length === 1 || index < lines.length - 1) terminal.writeln(line);
64
+ else terminal.write(line);
65
+ });
66
+ }
67
+ </script>
68
+
69
+ <style lang="scss">
70
+ .terminal-body {
71
+ width: 100%;
72
+ height: 100%;
73
+ background-color: v-bind(bodyBgc);
74
+ padding: 5px 0px 0px 10px;
75
+
76
+ // for terminal scroll bar style
77
+ .xterm .xterm-viewport {
78
+ &::-webkit-scrollbar {
79
+ border-radius: 50px;
80
+ width: 3px;
81
+ }
82
+
83
+ &::-moz-scrollbar {
84
+ border-radius: 50px;
85
+ width: 3px;
86
+ }
87
+
88
+ &::-ms-scrollbar {
89
+ border-radius: 50px;
90
+ width: 3px;
91
+ }
92
+
93
+ &::-webkit-scrollbar:hover {
94
+ width: 7px;
95
+ }
96
+
97
+ &::-moz-scrollbar:hover {
98
+ width: 7px;
99
+ }
100
+
101
+ &::-ms-scrollbar:hover {
102
+ width: 7px;
103
+ }
104
+
105
+ &::-webkit-scrollbar-thumb {
106
+ background-color: #929292;
107
+ border-radius: 50px;
108
+ height: 2px !important;
109
+ }
110
+
111
+ &::-moz-scrollbar-thumb {
112
+ background-color: #929292;
113
+ border-radius: 50px;
114
+ height: 2px !important;
115
+ }
116
+
117
+ &::-ms-scrollbar-thumb {
118
+ background-color: #929292;
119
+ border-radius: 50px;
120
+ height: 2px !important;
121
+ }
122
+
123
+ &::-webkit-scrollbar-thumb:hover {
124
+ background-color: #929292;
125
+ }
126
+
127
+ &::-moz-scrollbar-thumb:hover {
128
+ background-color: #929292;
129
+ }
130
+
131
+ &::-ms-scrollbar-thumb:hover {
132
+ background-color: #929292;
133
+ }
134
+
135
+ &:hover::-webkit-scrollbar-corner {
136
+ height: 40px;
137
+ }
138
+
139
+ &:hover::-moz-scrollbar-corner {
140
+ height: 40px;
141
+ }
142
+
143
+ &:hover::-ms-scrollbar-corner {
144
+ height: 40px;
145
+ }
146
+ }
147
+ }
148
+ </style>