@slidev/client 0.40.0 → 0.40.2

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.
@@ -32,25 +32,25 @@ function setBrushColor(color: typeof brush.color) {
32
32
  :initial-x="10"
33
33
  :initial-y="10"
34
34
  >
35
- <button class="icon-btn" :class="{ shallow: drawingMode !== 'stylus' }" @click="setDrawingMode('stylus')">
35
+ <button class="slidev-icon-btn" :class="{ shallow: drawingMode !== 'stylus' }" @click="setDrawingMode('stylus')">
36
36
  <carbon:pen />
37
37
  </button>
38
- <button class="icon-btn" :class="{ shallow: drawingMode !== 'line' }" @click="setDrawingMode('line')">
38
+ <button class="slidev-icon-btn" :class="{ shallow: drawingMode !== 'line' }" @click="setDrawingMode('line')">
39
39
  <svg width="1em" height="1em" class="-mt-0.5" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24">
40
40
  <path d="M21.71 3.29a1 1 0 0 0-1.42 0l-18 18a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l18-18a1 1 0 0 0 0-1.42z" fill="currentColor" />
41
41
  </svg>
42
42
  </button>
43
- <button class="icon-btn" :class="{ shallow: drawingMode !== 'arrow' }" @click="setDrawingMode('arrow')">
43
+ <button class="slidev-icon-btn" :class="{ shallow: drawingMode !== 'arrow' }" @click="setDrawingMode('arrow')">
44
44
  <carbon:arrow-up-right />
45
45
  </button>
46
- <button class="icon-btn" :class="{ shallow: drawingMode !== 'ellipse' }" @click="setDrawingMode('ellipse')">
46
+ <button class="slidev-icon-btn" :class="{ shallow: drawingMode !== 'ellipse' }" @click="setDrawingMode('ellipse')">
47
47
  <carbon:radio-button />
48
48
  </button>
49
- <button class="icon-btn" :class="{ shallow: drawingMode !== 'rectangle' }" @click="setDrawingMode('rectangle')">
49
+ <button class="slidev-icon-btn" :class="{ shallow: drawingMode !== 'rectangle' }" @click="setDrawingMode('rectangle')">
50
50
  <carbon:checkbox />
51
51
  </button>
52
52
  <!-- TODO: not sure why it's not working! -->
53
- <!-- <button class="icon-btn" :class="{ shallow: drawingMode != 'eraseLine' }" @click="setDrawingMode('eraseLine')">
53
+ <!-- <button class="slidev-icon-btn" :class="{ shallow: drawingMode != 'eraseLine' }" @click="setDrawingMode('eraseLine')">
54
54
  <carbon:erase />
55
55
  </button> -->
56
56
 
@@ -59,7 +59,7 @@ function setBrushColor(color: typeof brush.color) {
59
59
  <button
60
60
  v-for="color of brushColors"
61
61
  :key="color"
62
- class="icon-btn"
62
+ class="slidev-icon-btn"
63
63
  :class="brush.color === color ? 'active' : 'shallow'"
64
64
  @click="setBrushColor(color)"
65
65
  >
@@ -72,24 +72,24 @@ function setBrushColor(color: typeof brush.color) {
72
72
 
73
73
  <VerticalDivider />
74
74
 
75
- <button class="icon-btn" :class="{ disabled: !canUndo }" @click="undo()">
75
+ <button class="slidev-icon-btn" :class="{ disabled: !canUndo }" @click="undo()">
76
76
  <carbon:undo />
77
77
  </button>
78
- <button class="icon-btn" :class="{ disabled: !canRedo }" @click="redo()">
78
+ <button class="slidev-icon-btn" :class="{ disabled: !canRedo }" @click="redo()">
79
79
  <carbon:redo />
80
80
  </button>
81
- <button class="icon-btn" :class="{ disabled: !canClear }" @click="clearDrauu()">
81
+ <button class="slidev-icon-btn" :class="{ disabled: !canClear }" @click="clearDrauu()">
82
82
  <carbon:delete />
83
83
  </button>
84
84
 
85
85
  <VerticalDivider />
86
- <button class="icon-btn" :class="{ shallow: !drawingPinned }" @click="drawingPinned = !drawingPinned">
86
+ <button class="slidev-icon-btn" :class="{ shallow: !drawingPinned }" @click="drawingPinned = !drawingPinned">
87
87
  <carbon:pin-filled v-show="drawingPinned" class="transform -rotate-45" />
88
88
  <carbon:pin v-show="!drawingPinned" />
89
89
  </button>
90
90
  <button
91
91
  v-if="drawingEnabled"
92
- class="icon-btn"
92
+ class="slidev-icon-btn"
93
93
  :class="{ shallow: !drawingEnabled }"
94
94
  @click="drawingEnabled = !drawingEnabled"
95
95
  >
@@ -137,10 +137,10 @@ throttledWatch(
137
137
  >
138
138
  <div class="flex pb-2 text-xl -mt-1">
139
139
  <div class="mr-4 rounded flex">
140
- <button class="icon-btn" :class="tab === 'content' ? 'text-$slidev-theme-primary' : ''" @click="switchTab('content')">
140
+ <button class="slidev-icon-btn" :class="tab === 'content' ? 'text-$slidev-theme-primary' : ''" @click="switchTab('content')">
141
141
  <carbon:account />
142
142
  </button>
143
- <button class="icon-btn" :class="tab === 'note' ? 'text-$slidev-theme-primary' : ''" @click="switchTab('note')">
143
+ <button class="slidev-icon-btn" :class="tab === 'note' ? 'text-$slidev-theme-primary' : ''" @click="switchTab('note')">
144
144
  <carbon:align-box-bottom-right />
145
145
  </button>
146
146
  </div>
@@ -148,10 +148,10 @@ throttledWatch(
148
148
  {{ tab === 'content' ? 'Slide' : 'Notes' }}
149
149
  </span>
150
150
  <div class="flex-auto" />
151
- <button class="icon-btn" @click="openInEditor()">
151
+ <button class="slidev-icon-btn" @click="openInEditor()">
152
152
  <carbon:launch />
153
153
  </button>
154
- <button class="icon-btn" @click="close">
154
+ <button class="slidev-icon-btn" @click="close">
155
155
  <carbon:close />
156
156
  </button>
157
157
  </div>
@@ -51,26 +51,26 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
51
51
  :class="barStyle"
52
52
  @mouseleave="onMouseLeave"
53
53
  >
54
- <button v-if="!isEmbedded" class="icon-btn" @click="toggleFullscreen">
54
+ <button v-if="!isEmbedded" class="slidev-icon-btn" @click="toggleFullscreen">
55
55
  <carbon:minimize v-if="isFullscreen" />
56
56
  <carbon:maximize v-else />
57
57
  </button>
58
58
 
59
- <button class="icon-btn" :class="{ disabled: !hasPrev }" @click="prev">
59
+ <button class="slidev-icon-btn" :class="{ disabled: !hasPrev }" @click="prev">
60
60
  <carbon:arrow-left />
61
61
  </button>
62
62
 
63
- <button class="icon-btn" :class="{ disabled: !hasNext }" title="Next" @click="next">
63
+ <button class="slidev-icon-btn" :class="{ disabled: !hasNext }" title="Next" @click="next">
64
64
  <carbon:arrow-right />
65
65
  </button>
66
66
 
67
- <button v-if="!isEmbedded" class="icon-btn" title="Slides overview" @click="toggleOverview()">
67
+ <button v-if="!isEmbedded" class="slidev-icon-btn" title="Slides overview" @click="toggleOverview()">
68
68
  <carbon:apps />
69
69
  </button>
70
70
 
71
71
  <button
72
72
  v-if="!isColorSchemaConfigured"
73
- class="icon-btn"
73
+ class="slidev-icon-btn"
74
74
  title="Toggle dark mode"
75
75
  @click="toggleDark()"
76
76
  >
@@ -88,7 +88,7 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
88
88
 
89
89
  <button
90
90
  v-if="isPresenter"
91
- class="icon-btn"
91
+ class="slidev-icon-btn"
92
92
  title="Show presenter cursor"
93
93
  @click="showPresenterCursor = !showPresenterCursor"
94
94
  >
@@ -98,7 +98,7 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
98
98
  </template>
99
99
 
100
100
  <template v-if="__SLIDEV_FEATURE_DRAWINGS__ && (!configs.drawings.presenterOnly || isPresenter) && !isEmbedded">
101
- <button class="icon-btn relative" title="Drawing" @click="drawingEnabled = !drawingEnabled">
101
+ <button class="slidev-icon-btn relative" title="Drawing" @click="drawingEnabled = !drawingEnabled">
102
102
  <carbon:pen />
103
103
  <div
104
104
  v-if="drawingEnabled"
@@ -110,26 +110,26 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
110
110
  </template>
111
111
 
112
112
  <template v-if="!isEmbedded">
113
- <RouterLink v-if="isPresenter" :to="nonPresenterLink" class="icon-btn" title="Play Mode">
113
+ <RouterLink v-if="isPresenter" :to="nonPresenterLink" class="slidev-icon-btn" title="Play Mode">
114
114
  <carbon:presentation-file />
115
115
  </RouterLink>
116
- <RouterLink v-if="__SLIDEV_FEATURE_PRESENTER__ && showPresenter" :to="presenterLink" class="icon-btn" title="Presenter Mode">
116
+ <RouterLink v-if="__SLIDEV_FEATURE_PRESENTER__ && showPresenter" :to="presenterLink" class="slidev-icon-btn" title="Presenter Mode">
117
117
  <carbon:user-speaker />
118
118
  </RouterLink>
119
119
 
120
- <button v-if="__DEV__ && !isPresenter" class="icon-btn <md:hidden" @click="showEditor = !showEditor">
120
+ <button v-if="__DEV__ && !isPresenter" class="slidev-icon-btn <md:hidden" @click="showEditor = !showEditor">
121
121
  <carbon:text-annotation-toggle />
122
122
  </button>
123
123
  </template>
124
124
  <template v-if="!__DEV__">
125
- <button v-if="configs.download" class="icon-btn" @click="downloadPDF">
125
+ <button v-if="configs.download" class="slidev-icon-btn" @click="downloadPDF">
126
126
  <carbon:download />
127
127
  </button>
128
128
  </template>
129
129
 
130
130
  <button
131
131
  v-if="!isPresenter && configs.info && !isEmbedded"
132
- class="icon-btn"
132
+ class="slidev-icon-btn"
133
133
  @click="showInfoDialog = !showInfoDialog"
134
134
  >
135
135
  <carbon:information />
@@ -138,7 +138,7 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
138
138
  <template v-if="!isPresenter && !isEmbedded">
139
139
  <MenuButton>
140
140
  <template #button>
141
- <button class="icon-btn">
141
+ <button class="slidev-icon-btn">
142
142
  <carbon:settings-adjust />
143
143
  </button>
144
144
  </template>
@@ -56,14 +56,14 @@ function decreaseFontSize() {
56
56
  </div>
57
57
  <div class="flex-none border-t border-gray-400 border-opacity-20">
58
58
  <div class="flex gap-1 items-center px-6 py-3">
59
- <button class="icon-btn" @click="toggleFullscreen">
59
+ <button class="slidev-icon-btn" @click="toggleFullscreen">
60
60
  <carbon:minimize v-if="isFullscreen" />
61
61
  <carbon:maximize v-else />
62
62
  </button>
63
- <button class="icon-btn" @click="increaseFontSize">
63
+ <button class="slidev-icon-btn" @click="increaseFontSize">
64
64
  <carbon:zoom-in />
65
65
  </button>
66
- <button class="icon-btn" @click="decreaseFontSize">
66
+ <button class="slidev-icon-btn" @click="decreaseFontSize">
67
67
  <carbon:zoom-out />
68
68
  </button>
69
69
  <div class="flex-auto" />
@@ -35,7 +35,7 @@ onMounted(() => {
35
35
  <template>
36
36
  <button
37
37
  v-if="currentCamera !== 'none'"
38
- class="icon-btn <md:hidden"
38
+ class="slidev-icon-btn <md:hidden"
39
39
  :class="{ 'text-green-500': Boolean(showAvatar && streamCamera) }"
40
40
  title="Show camera view"
41
41
  @click="toggleAvatar"
@@ -44,7 +44,7 @@ onMounted(() => {
44
44
  </button>
45
45
 
46
46
  <button
47
- class="icon-btn"
47
+ class="slidev-icon-btn"
48
48
  :class="{ 'text-red-500': recording }"
49
49
  title="Recording"
50
50
  @click="toggleRecording"
@@ -54,7 +54,7 @@ onMounted(() => {
54
54
  </button>
55
55
  <MenuButton :disabled="recording">
56
56
  <template #button>
57
- <button class="icon-btn h-full !text-sm !px-0">
57
+ <button class="slidev-icon-btn h-full !text-sm !px-0">
58
58
  <carbon:chevron-up class="opacity-50" />
59
59
  </button>
60
60
  </template>
@@ -101,7 +101,7 @@ watchEffect(() => {
101
101
  </div>
102
102
  </div>
103
103
  </div>
104
- <button v-if="value" class="fixed text-2xl top-4 right-4 icon-btn text-gray-400" @click="close">
104
+ <button v-if="value" class="fixed text-2xl top-4 right-4 slidev-icon-btn text-gray-400" @click="close">
105
105
  <carbon:close />
106
106
  </button>
107
107
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
- "version": "0.40.0",
3
+ "version": "0.40.2",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -40,8 +40,8 @@
40
40
  "vue-router": "^4.1.6",
41
41
  "vue-starport": "^0.3.0",
42
42
  "windicss": "^3.5.6",
43
- "@slidev/parser": "0.40.0",
44
- "@slidev/types": "0.40.0"
43
+ "@slidev/parser": "0.40.2",
44
+ "@slidev/types": "0.40.2"
45
45
  },
46
46
  "devDependencies": {
47
47
  "vite": "^4.1.1"
package/setup/root.ts CHANGED
@@ -54,7 +54,7 @@ export default function setupRoot() {
54
54
  const routePath = router.currentRoute.value.path
55
55
  if (!routePath.match(/^\/(\d+|presenter)\/?/))
56
56
  return
57
- if (+state.page !== +currentPage.value || clicks.value !== state.clicks) {
57
+ if (+state.page !== +currentPage.value || +clicks.value !== +state.clicks) {
58
58
  router.replace({
59
59
  path: getPath(state.page),
60
60
  query: {
@@ -16,6 +16,8 @@ export function createSyncState<State extends object>(serverState: State, defaul
16
16
  }
17
17
 
18
18
  function patch<K extends keyof State>(key: K, value: State[K]) {
19
+ if (state[key] === value)
20
+ return
19
21
  clearTimeout(patchingTimeout)
20
22
  patching = true
21
23
  state[key] = value
@@ -46,7 +48,7 @@ export function createSyncState<State extends object>(serverState: State, defaul
46
48
  })
47
49
  }
48
50
 
49
- function onDrawingStateChanged() {
51
+ function onStateChanged() {
50
52
  if (!persist && stateChannel && !updating)
51
53
  stateChannel.postMessage(toRaw(state))
52
54
  else if (persist && !updating)
@@ -55,7 +57,7 @@ export function createSyncState<State extends object>(serverState: State, defaul
55
57
  onPatchCallbacks.forEach((fn: (state: State) => void) => fn(state))
56
58
  }
57
59
 
58
- watch(state, onDrawingStateChanged, { deep: true })
60
+ watch(state, onStateChanged, { deep: true })
59
61
  if (!__USE_SERVER__ && persist) {
60
62
  const serialzedState = window.localStorage.getItem(channelKey)
61
63
  if (serialzedState)
package/styles/index.css CHANGED
@@ -15,22 +15,22 @@ html {
15
15
  background: transparent;
16
16
  }
17
17
 
18
- .icon-btn {
18
+ .slidev-icon-btn {
19
19
  @apply inline-block cursor-pointer select-none !outline-none;
20
20
  @apply opacity-75 transition duration-200 ease-in-out align-middle rounded p-1;
21
21
  @apply hover:(opacity-100 bg-gray-400 bg-opacity-10);
22
22
  @apply md:p-2;
23
23
  }
24
24
 
25
- .icon-btn.shallow {
25
+ .slidev-icon-btn.shallow {
26
26
  @apply opacity-30
27
27
  }
28
28
 
29
- .icon-btn.active {
29
+ .slidev-icon-btn.active {
30
30
  @apply opacity-100
31
31
  }
32
32
 
33
- .icon-btn.disabled {
33
+ .slidev-icon-btn.disabled {
34
34
  @apply opacity-25 pointer-events-none;
35
35
  }
36
36