@vunk/form 1.1.82 → 1.1.83

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.
@@ -1,5 +1,5 @@
1
1
  import Vditor from 'vditor';
2
- import { inject, unref, ref, watch, defineComponent, nextTick, shallowRef, provide, onMounted, resolveComponent, openBlock, createElementBlock, Fragment, createElementVNode, createBlock, withCtx, normalizeClass, renderSlot, createCommentVNode } from 'vue';
2
+ import { inject, unref, ref, getCurrentScope, onScopeDispose, watch, defineComponent, nextTick, shallowRef, provide, onMounted, resolveComponent, openBlock, createElementBlock, Fragment, createElementVNode, createBlock, withCtx, normalizeClass, renderSlot, createCommentVNode } from 'vue';
3
3
  import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
4
4
  import { VkAsyncTeleport } from '@vunk/core';
5
5
 
@@ -46,12 +46,17 @@ const props = {
46
46
  "export",
47
47
  "|"
48
48
  ]
49
+ },
50
+ fullscreen: {
51
+ type: Boolean,
52
+ default: false
49
53
  }
50
54
  };
51
55
  const emits = {
52
56
  load: (e) => e,
53
57
  "update:modelValue": (e) => e,
54
- ctrlEnter: (e) => e
58
+ ctrlEnter: (e) => e,
59
+ "update:fullscreen": (e) => e
55
60
  };
56
61
 
57
62
  function mitt(n){return {all:n=n||new Map,on:function(t,e){var i=n.get(t);i?i.push(e):n.set(t,[e]);},off:function(t,e){var i=n.get(t);i&&(e?i.splice(i.indexOf(e)>>>0,1):n.set(t,[]));},emit:function(t,e){var i=n.get(t);i&&i.slice().map(function(n){n(e);}),(i=n.get("*"))&&i.slice().map(function(n){n(t,e);});}}}
@@ -99,17 +104,25 @@ function pausableFilter(extendFilter = bypassFilter) {
99
104
  return { isActive, pause, resume, eventFilter };
100
105
  }
101
106
 
102
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
103
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
104
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
107
+ function tryOnScopeDispose(fn) {
108
+ if (getCurrentScope()) {
109
+ onScopeDispose(fn);
110
+ return true;
111
+ }
112
+ return false;
113
+ }
114
+
115
+ var __getOwnPropSymbols$6$1 = Object.getOwnPropertySymbols;
116
+ var __hasOwnProp$6$1 = Object.prototype.hasOwnProperty;
117
+ var __propIsEnum$6$1 = Object.prototype.propertyIsEnumerable;
105
118
  var __objRest$5 = (source, exclude) => {
106
119
  var target = {};
107
120
  for (var prop in source)
108
- if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
121
+ if (__hasOwnProp$6$1.call(source, prop) && exclude.indexOf(prop) < 0)
109
122
  target[prop] = source[prop];
110
- if (source != null && __getOwnPropSymbols$6)
111
- for (var prop of __getOwnPropSymbols$6(source)) {
112
- if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
123
+ if (source != null && __getOwnPropSymbols$6$1)
124
+ for (var prop of __getOwnPropSymbols$6$1(source)) {
125
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6$1.call(source, prop))
113
126
  target[prop] = source[prop];
114
127
  }
115
128
  return target;
@@ -142,7 +155,7 @@ var __spreadValues$2 = (a, b) => {
142
155
  return a;
143
156
  };
144
157
  var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
145
- var __objRest$1 = (source, exclude) => {
158
+ var __objRest$1$1 = (source, exclude) => {
146
159
  var target = {};
147
160
  for (var prop in source)
148
161
  if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
@@ -157,7 +170,7 @@ var __objRest$1 = (source, exclude) => {
157
170
  function watchPausable(source, cb, options = {}) {
158
171
  const _a = options, {
159
172
  eventFilter: filter
160
- } = _a, watchOptions = __objRest$1(_a, [
173
+ } = _a, watchOptions = __objRest$1$1(_a, [
161
174
  "eventFilter"
162
175
  ]);
163
176
  const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
@@ -167,7 +180,71 @@ function watchPausable(source, cb, options = {}) {
167
180
  return { stop, pause, resume, isActive };
168
181
  }
169
182
 
170
- var _sfc_main$1 = defineComponent({
183
+ function unrefElement(elRef) {
184
+ var _a;
185
+ const plain = unref(elRef);
186
+ return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
187
+ }
188
+
189
+ const defaultWindow = isClient ? window : void 0;
190
+
191
+ const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
192
+ const globalKey = "__vueuse_ssr_handlers__";
193
+ _global[globalKey] = _global[globalKey] || {};
194
+
195
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
196
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
197
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
198
+ var __objRest$1 = (source, exclude) => {
199
+ var target = {};
200
+ for (var prop in source)
201
+ if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
202
+ target[prop] = source[prop];
203
+ if (source != null && __getOwnPropSymbols$6)
204
+ for (var prop of __getOwnPropSymbols$6(source)) {
205
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
206
+ target[prop] = source[prop];
207
+ }
208
+ return target;
209
+ };
210
+ function useMutationObserver(target, callback, options = {}) {
211
+ const _a = options, { window = defaultWindow } = _a, mutationOptions = __objRest$1(_a, ["window"]);
212
+ let observer;
213
+ const isSupported = window && "MutationObserver" in window;
214
+ const cleanup = () => {
215
+ if (observer) {
216
+ observer.disconnect();
217
+ observer = void 0;
218
+ }
219
+ };
220
+ const stopWatch = watch(() => unrefElement(target), (el) => {
221
+ cleanup();
222
+ if (isSupported && window && el) {
223
+ observer = new MutationObserver(callback);
224
+ observer.observe(el, mutationOptions);
225
+ }
226
+ }, { immediate: true });
227
+ const stop = () => {
228
+ cleanup();
229
+ stopWatch();
230
+ };
231
+ tryOnScopeDispose(stop);
232
+ return {
233
+ isSupported,
234
+ stop
235
+ };
236
+ }
237
+
238
+ var SwipeDirection;
239
+ (function(SwipeDirection2) {
240
+ SwipeDirection2["UP"] = "UP";
241
+ SwipeDirection2["RIGHT"] = "RIGHT";
242
+ SwipeDirection2["DOWN"] = "DOWN";
243
+ SwipeDirection2["LEFT"] = "LEFT";
244
+ SwipeDirection2["NONE"] = "NONE";
245
+ })(SwipeDirection || (SwipeDirection = {}));
246
+
247
+ var _sfc_main$2 = defineComponent({
171
248
  props: {
172
249
  modelValue: {
173
250
  type: String,
@@ -195,12 +272,55 @@ var _sfc_main$1 = defineComponent({
195
272
  }
196
273
  });
197
274
 
198
- var HandleValue = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/vditor/src/handle-value.vue"]]);
275
+ var HandleValue = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/vditor/src/handle-value.vue"]]);
276
+
277
+ var _sfc_main$1 = defineComponent({
278
+ props: {
279
+ fullscreen: {
280
+ type: Boolean,
281
+ default: false
282
+ }
283
+ },
284
+ emits: {
285
+ "update:fullscreen": null
286
+ },
287
+ setup(props, { emit }) {
288
+ const vditor = useVditor();
289
+ const el = vditor.vditor.element;
290
+ const domFullscreen = ref(false);
291
+ useMutationObserver(el, () => {
292
+ if (el.classList.contains("vditor--fullscreen")) {
293
+ domFullscreen.value = true;
294
+ } else {
295
+ domFullscreen.value = false;
296
+ }
297
+ }, {
298
+ attributes: true
299
+ });
300
+ watch(() => props.fullscreen, (value) => {
301
+ if (value !== domFullscreen.value) {
302
+ const ir = vditor.vditor.ir?.element;
303
+ if (!ir) return;
304
+ ir.dispatchEvent(new KeyboardEvent("keydown", {
305
+ key: "'",
306
+ ctrlKey: true
307
+ }));
308
+ }
309
+ }, { immediate: true });
310
+ watch(() => domFullscreen.value, (value) => {
311
+ emit("update:fullscreen", value);
312
+ });
313
+ return () => null;
314
+ }
315
+ });
316
+
317
+ var HandleFullscreen = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/vditor/src/handle-fullscreen.vue"]]);
199
318
 
200
319
  var _sfc_main = defineComponent({
201
320
  name: "VkfVditor",
202
321
  components: {
203
322
  HandleValue,
323
+ HandleFullscreen,
204
324
  VkAsyncTeleport
205
325
  },
206
326
  props,
@@ -233,6 +353,7 @@ var _sfc_main = defineComponent({
233
353
  props2.defaultOptions.input?.(value);
234
354
  },
235
355
  ctrlEnter(value) {
356
+ emit("update:modelValue", value);
236
357
  emit("ctrlEnter", value);
237
358
  },
238
359
  focus(v) {
@@ -261,6 +382,7 @@ const _hoisted_1 = {
261
382
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
262
383
  const _component_VkAsyncTeleport = resolveComponent("VkAsyncTeleport");
263
384
  const _component_HandleValue = resolveComponent("HandleValue");
385
+ const _component_HandleFullscreen = resolveComponent("HandleFullscreen");
264
386
  return openBlock(), createElementBlock(
265
387
  Fragment,
266
388
  null,
@@ -299,7 +421,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
299
421
  "model-value": _ctx.modelValue,
300
422
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", $event))
301
423
  }, null, 8, ["model-value"])) : createCommentVNode("v-if", true),
302
- _ctx.ready ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("v-if", true)
424
+ _ctx.ready ? (openBlock(), createBlock(_component_HandleFullscreen, {
425
+ key: 2,
426
+ fullscreen: _ctx.fullscreen,
427
+ "onUpdate:fullscreen": _cache[1] || (_cache[1] = ($event) => _ctx.$emit("update:fullscreen", $event))
428
+ }, null, 8, ["fullscreen"])) : createCommentVNode("v-if", true),
429
+ _ctx.ready ? renderSlot(_ctx.$slots, "default", { key: 3 }) : createCommentVNode("v-if", true)
303
430
  ],
304
431
  64
305
432
  /* STABLE_FRAGMENT */
@@ -18,9 +18,14 @@ export declare const props: {
18
18
  type: PropType<string[]>;
19
19
  default: () => string[];
20
20
  };
21
+ fullscreen: {
22
+ type: BooleanConstructor;
23
+ default: boolean;
24
+ };
21
25
  };
22
26
  export declare const emits: {
23
27
  load: (e: Vditor) => Vditor;
24
28
  'update:modelValue': (e: string) => string;
25
29
  ctrlEnter: (e: string) => string;
30
+ 'update:fullscreen': (e: boolean) => boolean;
26
31
  };
@@ -0,0 +1,18 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ fullscreen: {
3
+ type: BooleanConstructor;
4
+ default: boolean;
5
+ };
6
+ }, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
+ 'update:fullscreen': any;
8
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
9
+ fullscreen: {
10
+ type: BooleanConstructor;
11
+ default: boolean;
12
+ };
13
+ }>> & {
14
+ "onUpdate:fullscreen"?: (...args: any[] | unknown[]) => any;
15
+ }, {
16
+ fullscreen: boolean;
17
+ }, {}>;
18
+ export default _default;
@@ -17,6 +17,10 @@ declare const _default: import("vue").DefineComponent<{
17
17
  type: import("vue").PropType<string[]>;
18
18
  default: () => string[];
19
19
  };
20
+ fullscreen: {
21
+ type: BooleanConstructor;
22
+ default: boolean;
23
+ };
20
24
  }, {
21
25
  vditorNode: Ref<HTMLDivElement>;
22
26
  isTextareaFocus: Ref<boolean>;
@@ -25,6 +29,7 @@ declare const _default: import("vue").DefineComponent<{
25
29
  load: (e: Vditor) => Vditor;
26
30
  'update:modelValue': (e: string) => string;
27
31
  ctrlEnter: (e: string) => string;
32
+ 'update:fullscreen': (e: boolean) => boolean;
28
33
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
29
34
  modelValue: {
30
35
  type: StringConstructor;
@@ -42,14 +47,20 @@ declare const _default: import("vue").DefineComponent<{
42
47
  type: import("vue").PropType<string[]>;
43
48
  default: () => string[];
44
49
  };
50
+ fullscreen: {
51
+ type: BooleanConstructor;
52
+ default: boolean;
53
+ };
45
54
  }>> & {
46
55
  "onUpdate:modelValue"?: (e: string) => any;
47
56
  onLoad?: (e: Vditor) => any;
57
+ "onUpdate:fullscreen"?: (e: boolean) => any;
48
58
  onCtrlEnter?: (e: string) => any;
49
59
  }, {
50
60
  placeholder: string;
51
61
  modelValue: string;
52
62
  defaultOptions: IOptions;
63
+ fullscreen: boolean;
53
64
  toolbar: string[];
54
65
  }, {}>;
55
66
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vunk/form",
3
- "version": "1.1.82",
3
+ "version": "1.1.83",
4
4
  "description": "",
5
5
  "main": "index.esm.js",
6
6
  "scripts": {