@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.
Files changed (37) hide show
  1. package/dist/bundled/v2/{OrCode-fc6876ec.js → OrCode-0cf7596d.js} +184 -12
  2. package/dist/bundled/v2/{OrNotification-3909aaf2.js → OrNotification-2e2a1941.js} +3 -3
  3. package/dist/bundled/v2/{OrSkeletonText-242d22f3.js → OrSkeletonText-2f1a3cc7.js} +3 -3
  4. package/dist/bundled/v2/components/index.js +3 -3
  5. package/dist/bundled/v2/components/or-code/OrCode.vue.d.ts +10 -0
  6. package/dist/bundled/v2/components/or-code/index.js +1 -1
  7. package/dist/bundled/v2/components/or-notification/index.js +1 -1
  8. package/dist/bundled/v2/components/or-skeleton/index.js +1 -1
  9. package/dist/bundled/v2/index.js +4 -4
  10. package/dist/bundled/v3/{OrCode.vue_vue_type_script_lang-c55de81d.js → OrCode.vue_vue_type_script_lang-df150e3b.js} +180 -8
  11. package/dist/bundled/v3/components/index.js +1 -1
  12. package/dist/bundled/v3/components/or-code/OrCode.vue.d.ts +10 -0
  13. package/dist/bundled/v3/components/or-code/index.js +1 -1
  14. package/dist/bundled/v3/index.js +8 -8
  15. package/dist/esm/v2/{OrCode-d4400b42.js → OrCode-e2ce05ea.js} +30 -12
  16. package/dist/esm/v2/{OrNotification-a9231a83.js → OrNotification-a49e76d3.js} +3 -3
  17. package/dist/esm/v2/{OrSkeletonText-cc94bdc9.js → OrSkeletonText-24509efe.js} +3 -3
  18. package/dist/esm/v2/components/index.js +4 -3
  19. package/dist/esm/v2/components/or-code/OrCode.vue.d.ts +10 -0
  20. package/dist/esm/v2/components/or-code/index.js +3 -2
  21. package/dist/esm/v2/components/or-notification/index.js +1 -1
  22. package/dist/esm/v2/components/or-skeleton/index.js +1 -1
  23. package/dist/esm/v2/index.js +4 -3
  24. package/dist/esm/v3/{OrCode-5ed69c23.js → OrCode-72688173.js} +27 -9
  25. package/dist/esm/v3/{OrNotification-e85a4956.js → OrNotification-eb08de33.js} +1 -1
  26. package/dist/esm/v3/{OrSkeletonText-2b1610ce.js → OrSkeletonText-0546754d.js} +3 -3
  27. package/dist/esm/v3/components/index.js +4 -3
  28. package/dist/esm/v3/components/or-code/OrCode.vue.d.ts +10 -0
  29. package/dist/esm/v3/components/or-code/index.js +3 -2
  30. package/dist/esm/v3/components/or-notification/index.js +1 -1
  31. package/dist/esm/v3/components/or-skeleton/index.js +1 -1
  32. package/dist/esm/v3/index.js +4 -3
  33. package/package.json +4 -4
  34. package/src/components/or-code/OrCode.vue +23 -6
  35. package/src/components/or-notification/OrNotification.vue +26 -1
  36. package/src/components/or-skeleton/styles.scss +18 -3
  37. package/src/components/or-stepper/OrStepper.stories.ts +1 -1
@@ -1,4 +1,4 @@
1
- import { useElementHover } from '@vueuse/core';
1
+ import { useMutationObserver, useElementHover } from '@vueuse/core';
2
2
  import _ from 'lodash';
3
3
  import { defineComponent, ref } from 'vue';
4
4
  import { s as script$3 } from './OrTeleportVue3-012351e1.js';
@@ -23380,6 +23380,161 @@ const basicSetup = /*@__PURE__*/(() => [lineNumbers(), highlightActiveLineGutter
23380
23380
  fallback: true
23381
23381
  }), bracketMatching(), closeBrackets(), autocompletion(), rectangularSelection(), crosshairCursor(), highlightActiveLine(), highlightSelectionMatches(), keymap.of([...closeBracketsKeymap, ...defaultKeymap, ...searchKeymap, ...historyKeymap, ...foldKeymap, ...completionKeymap, ...lintKeymap])])();
23382
23382
 
23383
+ // Using https://github.com/one-dark/vscode-one-dark-theme/ as reference for the colors
23384
+ const chalky = "#e5c07b",
23385
+ coral = "#e06c75",
23386
+ cyan = "#56b6c2",
23387
+ invalid = "#ffffff",
23388
+ ivory = "#abb2bf",
23389
+ stone = "#7d8799",
23390
+ // Brightened compared to original to increase contrast
23391
+ malibu = "#61afef",
23392
+ sage = "#98c379",
23393
+ whiskey = "#d19a66",
23394
+ violet = "#c678dd",
23395
+ darkBackground = "#21252b",
23396
+ highlightBackground = "#2c313a",
23397
+ background = "#282c34",
23398
+ tooltipBackground = "#353a42",
23399
+ selection = "#3E4451",
23400
+ cursor = "#528bff";
23401
+ /**
23402
+ The editor theme styles for One Dark.
23403
+ */
23404
+ const oneDarkTheme = /*@__PURE__*/EditorView.theme({
23405
+ "&": {
23406
+ color: ivory,
23407
+ backgroundColor: background
23408
+ },
23409
+ ".cm-content": {
23410
+ caretColor: cursor
23411
+ },
23412
+ ".cm-cursor, .cm-dropCursor": {
23413
+ borderLeftColor: cursor
23414
+ },
23415
+ "&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": {
23416
+ backgroundColor: selection
23417
+ },
23418
+ ".cm-panels": {
23419
+ backgroundColor: darkBackground,
23420
+ color: ivory
23421
+ },
23422
+ ".cm-panels.cm-panels-top": {
23423
+ borderBottom: "2px solid black"
23424
+ },
23425
+ ".cm-panels.cm-panels-bottom": {
23426
+ borderTop: "2px solid black"
23427
+ },
23428
+ ".cm-searchMatch": {
23429
+ backgroundColor: "#72a1ff59",
23430
+ outline: "1px solid #457dff"
23431
+ },
23432
+ ".cm-searchMatch.cm-searchMatch-selected": {
23433
+ backgroundColor: "#6199ff2f"
23434
+ },
23435
+ ".cm-activeLine": {
23436
+ backgroundColor: "#6699ff0b"
23437
+ },
23438
+ ".cm-selectionMatch": {
23439
+ backgroundColor: "#aafe661a"
23440
+ },
23441
+ "&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket": {
23442
+ backgroundColor: "#bad0f847"
23443
+ },
23444
+ ".cm-gutters": {
23445
+ backgroundColor: background,
23446
+ color: stone,
23447
+ border: "none"
23448
+ },
23449
+ ".cm-activeLineGutter": {
23450
+ backgroundColor: highlightBackground
23451
+ },
23452
+ ".cm-foldPlaceholder": {
23453
+ backgroundColor: "transparent",
23454
+ border: "none",
23455
+ color: "#ddd"
23456
+ },
23457
+ ".cm-tooltip": {
23458
+ border: "none",
23459
+ backgroundColor: tooltipBackground
23460
+ },
23461
+ ".cm-tooltip .cm-tooltip-arrow:before": {
23462
+ borderTopColor: "transparent",
23463
+ borderBottomColor: "transparent"
23464
+ },
23465
+ ".cm-tooltip .cm-tooltip-arrow:after": {
23466
+ borderTopColor: tooltipBackground,
23467
+ borderBottomColor: tooltipBackground
23468
+ },
23469
+ ".cm-tooltip-autocomplete": {
23470
+ "& > ul > li[aria-selected]": {
23471
+ backgroundColor: highlightBackground,
23472
+ color: ivory
23473
+ }
23474
+ }
23475
+ }, {
23476
+ dark: true
23477
+ });
23478
+ /**
23479
+ The highlighting style for code in the One Dark theme.
23480
+ */
23481
+ const oneDarkHighlightStyle = /*@__PURE__*/HighlightStyle.define([{
23482
+ tag: tags$1.keyword,
23483
+ color: violet
23484
+ }, {
23485
+ tag: [tags$1.name, tags$1.deleted, tags$1.character, tags$1.propertyName, tags$1.macroName],
23486
+ color: coral
23487
+ }, {
23488
+ tag: [/*@__PURE__*/tags$1.function(tags$1.variableName), tags$1.labelName],
23489
+ color: malibu
23490
+ }, {
23491
+ tag: [tags$1.color, /*@__PURE__*/tags$1.constant(tags$1.name), /*@__PURE__*/tags$1.standard(tags$1.name)],
23492
+ color: whiskey
23493
+ }, {
23494
+ tag: [/*@__PURE__*/tags$1.definition(tags$1.name), tags$1.separator],
23495
+ color: ivory
23496
+ }, {
23497
+ tag: [tags$1.typeName, tags$1.className, tags$1.number, tags$1.changed, tags$1.annotation, tags$1.modifier, tags$1.self, tags$1.namespace],
23498
+ color: chalky
23499
+ }, {
23500
+ tag: [tags$1.operator, tags$1.operatorKeyword, tags$1.url, tags$1.escape, tags$1.regexp, tags$1.link, /*@__PURE__*/tags$1.special(tags$1.string)],
23501
+ color: cyan
23502
+ }, {
23503
+ tag: [tags$1.meta, tags$1.comment],
23504
+ color: stone
23505
+ }, {
23506
+ tag: tags$1.strong,
23507
+ fontWeight: "bold"
23508
+ }, {
23509
+ tag: tags$1.emphasis,
23510
+ fontStyle: "italic"
23511
+ }, {
23512
+ tag: tags$1.strikethrough,
23513
+ textDecoration: "line-through"
23514
+ }, {
23515
+ tag: tags$1.link,
23516
+ color: stone,
23517
+ textDecoration: "underline"
23518
+ }, {
23519
+ tag: tags$1.heading,
23520
+ fontWeight: "bold",
23521
+ color: coral
23522
+ }, {
23523
+ tag: [tags$1.atom, tags$1.bool, /*@__PURE__*/tags$1.special(tags$1.variableName)],
23524
+ color: whiskey
23525
+ }, {
23526
+ tag: [tags$1.processingInstruction, tags$1.string, tags$1.inserted],
23527
+ color: sage
23528
+ }, {
23529
+ tag: tags$1.invalid,
23530
+ color: invalid
23531
+ }]);
23532
+ /**
23533
+ Extension to enable the One Dark theme (both the editor theme and
23534
+ the highlight style).
23535
+ */
23536
+ const oneDark = [oneDarkTheme, /*@__PURE__*/syntaxHighlighting(oneDarkHighlightStyle)];
23537
+
23383
23538
  var OrCodeLanguages;
23384
23539
  (function (OrCodeLanguages) {
23385
23540
  OrCodeLanguages["JS"] = "javascript";
@@ -29475,6 +29630,20 @@ var script = defineComponent({
29475
29630
  setup(props, {
29476
29631
  emit
29477
29632
  }) {
29633
+ var _a;
29634
+ // theming refs
29635
+ const parent = document.querySelector('[data-theme]') || document.querySelector('html');
29636
+ const themeEl = ref(parent);
29637
+ const isDark = ref(((_a = parent === null || parent === void 0 ? void 0 : parent.getAttribute) === null || _a === void 0 ? void 0 : _a.call(parent, 'data-theme')) === 'dark');
29638
+ const themeObserver = useMutationObserver(themeEl, mutations => {
29639
+ var _a, _b;
29640
+ const mutation = mutations.find(m => m.attributeName === 'data-theme');
29641
+ if (!mutation) return;
29642
+ isDark.value = ((_b = (_a = mutation.target) === null || _a === void 0 ? void 0 : _a.getAttribute) === null || _b === void 0 ? void 0 : _b.call(_a, 'data-theme')) === 'dark';
29643
+ }, {
29644
+ attributes: true
29645
+ });
29646
+ // editor config
29478
29647
  const root = ref();
29479
29648
  const target = ref();
29480
29649
  const fullscreenTarget = ref();
@@ -29494,7 +29663,9 @@ var script = defineComponent({
29494
29663
  target,
29495
29664
  fullscreenTarget,
29496
29665
  editor,
29497
- isHovered
29666
+ isHovered,
29667
+ isDark,
29668
+ themeObserver
29498
29669
  };
29499
29670
  },
29500
29671
  data() {
@@ -29516,9 +29687,11 @@ var script = defineComponent({
29516
29687
  allowPaste,
29517
29688
  lineWrapping
29518
29689
  } = this;
29519
- const ext = _.compact([
29690
+ const ext = _.compact([...(this.isDark ? [oneDark] : []),
29520
29691
  // Toggle light/dark mode
29521
- EditorView.baseTheme({}),
29692
+ this.isDark ? EditorView.theme({}, {
29693
+ dark: true
29694
+ }) : EditorView.baseTheme({}),
29522
29695
  // locale settings
29523
29696
  this.phrases ? EditorState.phrases.of(this.phrases) : undefined,
29524
29697
  // Parser language setting
@@ -29545,10 +29718,8 @@ var script = defineComponent({
29545
29718
  }
29546
29719
  }),
29547
29720
  // line wrapping
29548
- lineWrapping ? EditorView.lineWrapping : undefined, keymap.of([indentWithTab])]);
29549
- // Append Extensions (such as basic-setup)
29550
- if (this.extensions.length !== 0) _.merge(ext, this.extensions);
29551
- return ext;
29721
+ lineWrapping ? EditorView.lineWrapping : undefined, keymap.of([indentWithTab]), ...this.extensions]);
29722
+ return [...ext];
29552
29723
  },
29553
29724
  isShowingError() {
29554
29725
  return !!this.error && this.isInvalid;
@@ -29591,6 +29762,7 @@ var script = defineComponent({
29591
29762
  },
29592
29763
  beforeUnmount() {
29593
29764
  var _a;
29765
+ this.themeObserver.stop();
29594
29766
  (_a = this.editor) === null || _a === void 0 ? void 0 : _a.destroy();
29595
29767
  },
29596
29768
  methods: {
@@ -15,7 +15,7 @@ export { s as OrCheckbox } from '../OrCheckbox.vue_vue_type_script_lang-d8a66818
15
15
  export { s as OrCheckboxV3 } from '../OrCheckbox.vue_vue_type_script_lang-fc067611.js';
16
16
  export { s as OrChip } from '../OrChip-5d502431.js';
17
17
  export { s as OrChips } from '../OrChips.vue_vue_type_script_lang-69917e34.js';
18
- export { s as OrCode, O as OrCodeLanguages } from '../OrCode.vue_vue_type_script_lang-c55de81d.js';
18
+ export { s as OrCode, O as OrCodeLanguages } from '../OrCode.vue_vue_type_script_lang-df150e3b.js';
19
19
  export { s as OrCollapse } from '../OrCollapse.vue_vue_type_script_lang-65cbb754.js';
20
20
  export { s as OrColorPicker, h as amber, n as black, b as blue, m as blueGrey, k as brown, c as cyan, j as deepOrange, d as deepPurple, g as green, i as indigo, l as lightBlue, e as lightGreen, f as lime, o as orange, p as pink, a as purple, r as red, t as teal, w as white, y as yellow } from '../OrColorPicker.vue_vue_type_script_lang-4141378d.js';
21
21
  export { s as OrConfirm } from '../OrConfirm.vue_vue_type_script_lang-41b4d791.js';
@@ -9,6 +9,11 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
9
9
  fullscreenTarget: Ref<HTMLDivElement | undefined>;
10
10
  editor: EditorView;
11
11
  isHovered: Ref<boolean>;
12
+ isDark: Ref<boolean>;
13
+ themeObserver: {
14
+ isSupported: Ref<boolean>;
15
+ stop: () => void;
16
+ };
12
17
  }> & {
13
18
  isFullscreen: boolean;
14
19
  }, {
@@ -168,6 +173,11 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
168
173
  fullscreenTarget: Ref<HTMLDivElement | undefined>;
169
174
  editor: EditorView;
170
175
  isHovered: Ref<boolean>;
176
+ isDark: Ref<boolean>;
177
+ themeObserver: {
178
+ isSupported: Ref<boolean>;
179
+ stop: () => void;
180
+ };
171
181
  }>, {
172
182
  isFullscreen: boolean;
173
183
  }, {
@@ -1,4 +1,4 @@
1
- export { s as OrCode, O as OrCodeLanguages } from '../../OrCode.vue_vue_type_script_lang-c55de81d.js';
1
+ export { s as OrCode, O as OrCodeLanguages } from '../../OrCode.vue_vue_type_script_lang-df150e3b.js';
2
2
  import '@vueuse/core';
3
3
  import 'lodash';
4
4
  import 'vue';