@onereach/ui-components 2.72.1 → 2.73.0-beta.2258.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/dist/bundled/v2/{OrCode-fc6876ec.js → OrCode-0cf7596d.js} +184 -12
- package/dist/bundled/v2/{OrNotification-3909aaf2.js → OrNotification-2e2a1941.js} +3 -3
- package/dist/bundled/v2/{OrSkeletonText-242d22f3.js → OrSkeletonText-2f1a3cc7.js} +3 -3
- package/dist/bundled/v2/components/index.js +3 -3
- package/dist/bundled/v2/components/or-code/OrCode.vue.d.ts +10 -0
- package/dist/bundled/v2/components/or-code/index.js +1 -1
- package/dist/bundled/v2/components/or-notification/index.js +1 -1
- package/dist/bundled/v2/components/or-skeleton/index.js +1 -1
- package/dist/bundled/v2/index.js +4 -4
- package/dist/bundled/v3/{OrCode.vue_vue_type_script_lang-c55de81d.js → OrCode.vue_vue_type_script_lang-df150e3b.js} +180 -8
- package/dist/bundled/v3/components/index.js +1 -1
- package/dist/bundled/v3/components/or-code/OrCode.vue.d.ts +10 -0
- package/dist/bundled/v3/components/or-code/index.js +1 -1
- package/dist/bundled/v3/index.js +8 -8
- package/dist/esm/v2/{OrCode-d4400b42.js → OrCode-e2ce05ea.js} +30 -12
- package/dist/esm/v2/{OrNotification-a9231a83.js → OrNotification-a49e76d3.js} +3 -3
- package/dist/esm/v2/{OrSkeletonText-cc94bdc9.js → OrSkeletonText-24509efe.js} +3 -3
- package/dist/esm/v2/components/index.js +4 -3
- package/dist/esm/v2/components/or-code/OrCode.vue.d.ts +10 -0
- package/dist/esm/v2/components/or-code/index.js +3 -2
- package/dist/esm/v2/components/or-notification/index.js +1 -1
- package/dist/esm/v2/components/or-skeleton/index.js +1 -1
- package/dist/esm/v2/index.js +4 -3
- package/dist/esm/v3/{OrCode-5ed69c23.js → OrCode-72688173.js} +27 -9
- package/dist/esm/v3/{OrNotification-e85a4956.js → OrNotification-eb08de33.js} +1 -1
- package/dist/esm/v3/{OrSkeletonText-2b1610ce.js → OrSkeletonText-0546754d.js} +3 -3
- package/dist/esm/v3/components/index.js +4 -3
- package/dist/esm/v3/components/or-code/OrCode.vue.d.ts +10 -0
- package/dist/esm/v3/components/or-code/index.js +3 -2
- package/dist/esm/v3/components/or-notification/index.js +1 -1
- package/dist/esm/v3/components/or-skeleton/index.js +1 -1
- package/dist/esm/v3/index.js +4 -3
- package/package.json +4 -4
- package/src/components/or-code/OrCode.vue +23 -6
- package/src/components/or-notification/OrNotification.vue +26 -1
- package/src/components/or-skeleton/styles.scss +18 -3
- package/src/components/or-stepper/OrStepper.stories.ts +1 -1
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<or-icon-button
|
|
25
25
|
v-if="isShowingFullscreen"
|
|
26
26
|
icon="fullscreen"
|
|
27
|
-
icon-color="neutral-
|
|
27
|
+
icon-color="neutral-4"
|
|
28
28
|
class="fullscreen-button"
|
|
29
29
|
@click="toggleFullscreen(true)"
|
|
30
30
|
/>
|
|
@@ -85,8 +85,9 @@ import { Language, LanguageSupport } from '@codemirror/language';
|
|
|
85
85
|
import { EditorState, Extension, Transaction } from '@codemirror/state';
|
|
86
86
|
import { ViewUpdate, keymap } from '@codemirror/view';
|
|
87
87
|
import { indentWithTab } from '@codemirror/commands';
|
|
88
|
-
import { useElementHover } from '@vueuse/core';
|
|
89
88
|
import { basicSetup, EditorView } from 'codemirror';
|
|
89
|
+
import { useElementHover, useMutationObserver, type MaybeElementRef } from '@vueuse/core';
|
|
90
|
+
import { oneDark } from '@codemirror/theme-one-dark';
|
|
90
91
|
import _ from 'lodash';
|
|
91
92
|
import { defineComponent, PropType, ref, Ref } from 'vue-demi';
|
|
92
93
|
import { OrIconButton } from '../or-button-v2';
|
|
@@ -185,6 +186,19 @@ export default defineComponent({
|
|
|
185
186
|
emits: ['update:modelValue', 'focus', 'blur'],
|
|
186
187
|
|
|
187
188
|
setup(props, { emit }) {
|
|
189
|
+
// theming refs
|
|
190
|
+
const parent: Element | null = document.querySelector('[data-theme]') || document.querySelector('html');
|
|
191
|
+
const themeEl = ref<HTMLElement | null>(parent as HTMLElement);
|
|
192
|
+
const isDark = ref<boolean>(parent?.getAttribute?.('data-theme') === 'dark');
|
|
193
|
+
|
|
194
|
+
const themeObserver = useMutationObserver(themeEl, (mutations) => {
|
|
195
|
+
const mutation = mutations.find((m) => m.attributeName === 'data-theme');
|
|
196
|
+
if (!mutation) return;
|
|
197
|
+
isDark.value = (mutation.target as HTMLElement)?.getAttribute?.('data-theme') === 'dark';
|
|
198
|
+
}, {
|
|
199
|
+
attributes: true,
|
|
200
|
+
});
|
|
201
|
+
// editor config
|
|
188
202
|
const root = ref<HTMLDivElement>();
|
|
189
203
|
const target = ref<HTMLDivElement>();
|
|
190
204
|
const fullscreenTarget = ref<HTMLDivElement>();
|
|
@@ -206,6 +220,8 @@ export default defineComponent({
|
|
|
206
220
|
fullscreenTarget,
|
|
207
221
|
editor,
|
|
208
222
|
isHovered,
|
|
223
|
+
isDark,
|
|
224
|
+
themeObserver,
|
|
209
225
|
};
|
|
210
226
|
},
|
|
211
227
|
|
|
@@ -226,8 +242,9 @@ export default defineComponent({
|
|
|
226
242
|
localExtensions(): Extension[] {
|
|
227
243
|
const { allowDrop, allowPaste, lineWrapping } = this;
|
|
228
244
|
const ext = _.compact([
|
|
245
|
+
...(this.isDark ? [oneDark] : []),
|
|
229
246
|
// Toggle light/dark mode
|
|
230
|
-
EditorView.baseTheme({}),
|
|
247
|
+
this.isDark ? EditorView.theme({}, { dark: true }) : EditorView.baseTheme({}),
|
|
231
248
|
// locale settings
|
|
232
249
|
this.phrases ? EditorState.phrases.of(this.phrases) : undefined,
|
|
233
250
|
// Parser language setting
|
|
@@ -259,11 +276,10 @@ export default defineComponent({
|
|
|
259
276
|
// line wrapping
|
|
260
277
|
lineWrapping ? EditorView.lineWrapping : undefined,
|
|
261
278
|
keymap.of([indentWithTab]),
|
|
279
|
+
...this.extensions,
|
|
262
280
|
]) as Extension[];
|
|
263
281
|
|
|
264
|
-
|
|
265
|
-
if (this.extensions.length !== 0) _.merge(ext, this.extensions);
|
|
266
|
-
return ext;
|
|
282
|
+
return [...ext];
|
|
267
283
|
},
|
|
268
284
|
isShowingError(): boolean {
|
|
269
285
|
return !!this.error && this.isInvalid;
|
|
@@ -313,6 +329,7 @@ export default defineComponent({
|
|
|
313
329
|
},
|
|
314
330
|
|
|
315
331
|
beforeUnmount() {
|
|
332
|
+
this.themeObserver.stop();
|
|
316
333
|
this.editor?.destroy();
|
|
317
334
|
},
|
|
318
335
|
|
|
@@ -115,7 +115,6 @@ export default defineComponent({
|
|
|
115
115
|
warning: ($c-warning, $c-warning-lighten-45),
|
|
116
116
|
success: ($c-success, $c-success-lighten-45),
|
|
117
117
|
);
|
|
118
|
-
|
|
119
118
|
/** TODO: Override when mobile design is ready to guarantee alignment of icons with first text row */
|
|
120
119
|
--alignment-height: #{$lh-1};
|
|
121
120
|
|
|
@@ -178,4 +177,30 @@ export default defineComponent({
|
|
|
178
177
|
}
|
|
179
178
|
}
|
|
180
179
|
}
|
|
180
|
+
|
|
181
|
+
[data-theme="dark"] {
|
|
182
|
+
.or-notification {
|
|
183
|
+
$notification-types: (
|
|
184
|
+
info: ($c-neutral-6, $c-primary-darken-45),
|
|
185
|
+
error: ($c-neutral-6, $c-error-darken-45),
|
|
186
|
+
warning: ($c-neutral-6, $c-warning-darken-45),
|
|
187
|
+
success: ($c-neutral-6, $c-success-darken-45),
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
.or-icon {
|
|
191
|
+
color: $c-neutral-1;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
@each $type, $colors in $notification-types {
|
|
195
|
+
&.is-type-#{$type} {
|
|
196
|
+
background-color: list.nth($colors, 2);
|
|
197
|
+
color: list.nth($colors, 1);
|
|
198
|
+
|
|
199
|
+
a {
|
|
200
|
+
color: list.nth($colors, 1);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
181
206
|
</style>
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
$c-skeleton-center: #fff;
|
|
12
|
+
$c-skeleton-bg: #f6f8fd;
|
|
13
|
+
$c-skeleton-center: #fff;
|
|
15
14
|
|
|
15
|
+
.or-skeleton {
|
|
16
16
|
overflow: hidden;
|
|
17
17
|
position: relative;
|
|
18
18
|
padding: 0;
|
|
@@ -33,3 +33,18 @@
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
[data-theme="dark"] {
|
|
39
|
+
$c-skeleton-dark-bg: $c-neutral-3;
|
|
40
|
+
$c-skeleton-dark-center: $c-neutral-2;
|
|
41
|
+
|
|
42
|
+
.or-skeleton {
|
|
43
|
+
background: $c-skeleton-dark-bg;
|
|
44
|
+
&.is-animated {
|
|
45
|
+
&::before {
|
|
46
|
+
background: linear-gradient(90.14deg, $c-skeleton-dark-bg 0.1%, $c-skeleton-dark-center 49.98%, $c-skeleton-dark-bg 99.06%);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -30,7 +30,7 @@ const Template: Story = (_args, { argTypes }) => ({
|
|
|
30
30
|
},
|
|
31
31
|
//<component :key="slot.Id" :someProp="slotProps"></component>
|
|
32
32
|
//<template #buttons="{onConfirm}"> here your button slot props <or-button content="slot-confirm" @click="onConfirm"/></template>
|
|
33
|
-
template: '<div><or-stepper v-bind="$props"> <template v-for="slot in slots" v-slot:[slot]="slotProps"><p class="bg-surface-5 rounded-sm p-
|
|
33
|
+
template: '<div><or-stepper v-bind="$props"> <template v-for="slot in slots" v-slot:[slot]="slotProps"><p class="bg-surface-5 text-on-surface rounded-sm p-md"> your slot named like content-{index} === {{slot}} ; slot props {{slotProps}}</p></template></or-stepper></div>',
|
|
34
34
|
|
|
35
35
|
});
|
|
36
36
|
|