@tak-ps/vue-tabler 4.18.0 → 4.21.0

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/CHANGELOG.md CHANGED
@@ -10,6 +10,21 @@
10
10
 
11
11
  ## Version History
12
12
 
13
+ ### v4.21.0
14
+
15
+ - :rocket: Migrate to more modern `marked` instead of `showdown`
16
+
17
+ ### v4.20.0
18
+
19
+ - :bug: Fix hover state
20
+
21
+ ### v4.19.1
22
+
23
+ - :bug: Fix `TablerBorder` `tools` slot not appearing on hover when scoped CSS selector matched the wrong element
24
+
25
+ ### v4.19.0
26
+
27
+ - :rocket: Simplify `TablerBorder` to expose a generic `tools` slot for hover-revealed actions; remove edit-specific props and slots
13
28
  ### v4.17.0
14
29
 
15
30
  - :rocket: `TablerBorder` now supports `background`, `editable`, `editing`, `editAriaLabel` props plus `actions` and `editor` slots and an `edit` event for inline edit container patterns
package/README.md CHANGED
@@ -96,7 +96,7 @@ import { TablerButton, TablerAlert } from '@tak-ps/vue-tabler';
96
96
  This library relies on the following core dependencies:
97
97
  - [Vue 3](https://vuejs.org/)
98
98
  - [@tabler/icons-vue](https://www.npmjs.com/package/@tabler/icons-vue)
99
- - [showdown](https://www.npmjs.com/package/showdown) (for Markdown rendering)
99
+ - [marked](https://www.npmjs.com/package/marked) (for Markdown rendering)
100
100
 
101
101
  ## 📄 License
102
102
 
@@ -1,17 +1,11 @@
1
1
  <template>
2
2
  <div
3
- class='card border border-light-subtle'
3
+ class='card tabler-border border border-light-subtle'
4
4
  :class='{
5
5
  "h-100": fillHeight,
6
6
  "shadow-sm": shadow,
7
- "tabler-border--clickable": clickable,
8
7
  }'
9
8
  :style='backgroundStyle'
10
- :role='clickable ? "button" : undefined'
11
- :tabindex='clickable ? 0 : undefined'
12
- @click='handleClick'
13
- @keyup.enter='handleClick'
14
- @keyup.space.prevent='handleClick'
15
9
  >
16
10
  <div
17
11
  class='card-body d-flex flex-column position-relative'
@@ -36,36 +30,19 @@
36
30
  </div>
37
31
 
38
32
  <div
39
- v-if='showActions'
40
- class='tabler-border__actions position-absolute'
33
+ v-if='$slots.tools'
34
+ class='tabler-border__tools position-absolute'
41
35
  >
42
- <slot name='actions'>
43
- <TablerIconButton
44
- v-if='editable && !editing'
45
- :title='resolvedEditAriaLabel'
46
- @click.stop.prevent='emit("edit")'
47
- >
48
- <IconPencil
49
- :size='24'
50
- stroke='1'
51
- />
52
- </TablerIconButton>
53
- </slot>
36
+ <slot name='tools' />
54
37
  </div>
55
38
 
56
- <slot
57
- v-if='editing'
58
- name='editor'
59
- />
60
- <slot v-else />
39
+ <slot />
61
40
  </div>
62
41
  </div>
63
42
  </template>
64
43
 
65
44
  <script setup lang='ts'>
66
- import { computed, useSlots } from 'vue';
67
- import TablerIconButton from './IconButton.vue';
68
- import { IconPencil } from '@tabler/icons-vue';
45
+ import { computed } from 'vue';
69
46
 
70
47
  export interface BorderProps {
71
48
  label?: string;
@@ -73,9 +50,6 @@ export interface BorderProps {
73
50
  background?: string;
74
51
  shadow?: boolean;
75
52
  fillHeight?: boolean;
76
- editable?: boolean;
77
- editing?: boolean;
78
- editAriaLabel?: string;
79
53
  }
80
54
 
81
55
  const props = withDefaults(defineProps<BorderProps>(), {
@@ -84,65 +58,25 @@ const props = withDefaults(defineProps<BorderProps>(), {
84
58
  background: '',
85
59
  shadow: true,
86
60
  fillHeight: true,
87
- editable: false,
88
- editing: false,
89
- editAriaLabel: '',
90
61
  });
91
62
 
92
- const emit = defineEmits<{
93
- edit: [];
94
- }>();
95
-
96
- const slots = useSlots();
97
-
98
63
  const backgroundStyle = computed(() => {
99
64
  if (!props.background) return undefined;
100
65
  return { backgroundColor: props.background };
101
66
  });
102
-
103
- const clickable = computed(() => props.editable && !props.editing);
104
-
105
- const showActions = computed(() => {
106
- if (slots.actions) return true;
107
- return props.editable && !props.editing;
108
- });
109
-
110
- const resolvedEditAriaLabel = computed(() => {
111
- if (props.editAriaLabel) return props.editAriaLabel;
112
- if (props.label) return `Edit ${props.label.toLowerCase()}`;
113
- return 'Edit';
114
- });
115
-
116
- function handleClick(): void {
117
- if (!clickable.value) return;
118
- emit('edit');
119
- }
120
67
  </script>
121
68
 
122
69
  <style scoped>
123
- .tabler-border--clickable {
124
- cursor: pointer;
125
- }
126
-
127
- .tabler-border--clickable:focus-visible {
128
- outline: 2px solid rgba(var(--tblr-primary-rgb, 32, 107, 196), 0.7);
129
- outline-offset: 2px;
130
- }
131
-
132
- .tabler-border__actions {
70
+ .tabler-border__tools {
133
71
  top: 8px;
134
72
  right: 8px;
135
- opacity: 1;
136
- transition: opacity 0.15s ease-in-out;
137
- }
138
-
139
- .tabler-border--clickable .tabler-border__actions {
73
+ z-index: 2;
140
74
  opacity: 0;
75
+ transition: opacity 0.15s ease-in-out;
141
76
  }
142
77
 
143
- .tabler-border--clickable:hover .tabler-border__actions,
144
- .tabler-border--clickable:focus-visible .tabler-border__actions,
145
- .tabler-border__actions:focus-within {
78
+ .tabler-border:hover > .card-body > .tabler-border__tools,
79
+ .tabler-border:focus-within > .card-body > .tabler-border__tools {
146
80
  opacity: 1;
147
81
  }
148
82
  </style>
@@ -7,8 +7,7 @@
7
7
 
8
8
  <script setup lang="ts">
9
9
  import { computed } from 'vue'
10
- // @ts-expect-error: showdown types not available
11
- import showdown from 'showdown'
10
+ import { marked } from 'marked'
12
11
 
13
12
  export interface MarkdownProps {
14
13
  markdown: string;
@@ -20,11 +19,9 @@ const props = withDefaults(defineProps<MarkdownProps>(), {
20
19
  });
21
20
 
22
21
  const html = computed(() => {
23
- const converter = new showdown.Converter({
24
- tables: true,
25
- tasklists: true,
26
- emoji: true
22
+ return marked.parse(props.markdown, {
23
+ async: false,
24
+ gfm: true
27
25
  })
28
- return converter.makeHtml(props.markdown)
29
26
  })
30
27
  </script>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/vue-tabler",
3
3
  "type": "module",
4
- "version": "4.18.0",
4
+ "version": "4.21.0",
5
5
  "lib": "lib.ts",
6
6
  "main": "lib.ts",
7
7
  "module": "lib.ts",
@@ -27,7 +27,7 @@
27
27
  "homepage": "https://github.com/tak-ps/vue-tabler#readme",
28
28
  "dependencies": {
29
29
  "@tabler/icons-vue": "^3.0.0",
30
- "showdown": "^2.1.0"
30
+ "marked": "^18.0.2"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "vue": "^3.5.12",