nightshade 1.0.3 → 1.1.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.
@@ -1,580 +0,0 @@
1
- var k = Object.defineProperty;
2
- var i = (e, n) => k(e, "name", { value: n, configurable: !0 });
3
- import { openBlock as s, createBlock as f, resolveDynamicComponent as _, normalizeClass as p, withCtx as b, renderSlot as u, createElementBlock as m, createCommentVNode as h, toDisplayString as S, Transition as T, createElementVNode as y, resolveComponent as v, Teleport as C, withModifiers as B, normalizeStyle as z, createVNode as $, mergeProps as w } from "vue";
4
- import { g as N } from "./dom-LZO9EPGL.js";
5
- const c = /* @__PURE__ */ i((e, n) => {
6
- const t = e.__vccOpts || e;
7
- for (const [l, a] of n)
8
- t[l] = a;
9
- return t;
10
- }, "_export_sfc"), E = {
11
- props: {
12
- label: { type: String },
13
- title: { type: String },
14
- icon: { type: String },
15
- iconPos: { type: String, default: "left" },
16
- kind: { type: String, default: "link-default" },
17
- hoverKind: { type: String },
18
- customTag: { type: String },
19
- href: { type: String },
20
- debounce: { type: Number, default: 0 },
21
- disabled: { type: Boolean, default: !1 },
22
- size: { type: String, default: "normal" },
23
- square: { type: Boolean, default: !1 },
24
- block: { type: Boolean, default: !1 },
25
- round: { type: Boolean, default: !1 },
26
- outline: { type: Boolean, default: !1 },
27
- pseudoFocus: { type: Boolean, default: !1 },
28
- pseudoHover: { type: Boolean, default: !1 },
29
- pseudoActive: { type: Boolean, default: !1 }
30
- },
31
- data() {
32
- return {
33
- hover: !1,
34
- blocked: !1
35
- };
36
- },
37
- computed: {
38
- tagName() {
39
- return this.customTag ?? "button";
40
- },
41
- actualKind() {
42
- const { kind: e, hoverKind: n, hover: t } = this;
43
- return t ? n ?? e : e;
44
- }
45
- },
46
- methods: {
47
- onUiActivate() {
48
- this.debounce > 0 && (this.blocked = !0, setTimeout(() => {
49
- this.blocked = !1;
50
- }, this.debounce));
51
- }
52
- }
53
- }, H = {
54
- key: 0,
55
- class: "Label"
56
- };
57
- function V(e, n, t, l, a, o) {
58
- return s(), f(_(o.tagName), {
59
- ref: "button",
60
- class: p(["Btn button", [
61
- `Btn-${t.size}`,
62
- `Btn-${o.actualKind}`,
63
- `Btn-iconPos-${t.iconPos}`,
64
- {
65
- "Btn-disabled": t.disabled || a.blocked,
66
- "Btn-square": t.square,
67
- "Btn-round": t.round,
68
- "Btn-outline": t.outline,
69
- "Btn-block": t.block,
70
- "Btn-pseudo-focus": t.pseudoFocus,
71
- "Btn-pseudo-hover": t.pseudoHover,
72
- "Btn-pseudo-active": t.pseudoActive
73
- }
74
- ]]),
75
- disabled: t.disabled || a.blocked,
76
- title: t.title ?? t.label,
77
- href: t.href,
78
- onUiactivate: n[0] || (n[0] = (r) => o.onUiActivate(r)),
79
- onMouseenter: n[1] || (n[1] = (r) => a.hover = !0),
80
- onMouseleave: n[2] || (n[2] = (r) => a.hover = !1)
81
- }, {
82
- default: b(() => [
83
- u(e.$slots, "icon", {
84
- hover: a.hover,
85
- blocked: a.blocked
86
- }, () => [
87
- t.icon ? (s(), m("i", {
88
- key: 0,
89
- class: p([t.icon, "Icon"])
90
- }, null, 2)) : h("", !0)
91
- ], !0),
92
- t.label ? (s(), m("span", H, S(t.label), 1)) : h("", !0),
93
- u(e.$slots, "default", {
94
- hover: a.hover,
95
- blocked: a.blocked
96
- }, void 0, !0)
97
- ]),
98
- _: 3
99
- }, 40, ["class", "disabled", "title", "href"]);
100
- }
101
- i(V, "_sfc_render$c");
102
- const R = /* @__PURE__ */ c(E, [["render", V], ["__scopeId", "data-v-7dcc9af4"]]), x = {
103
- props: {
104
- dir: { type: String, default: "bottom" },
105
- align: { type: String, default: "start" }
106
- }
107
- }, A = { class: "Body" };
108
- function D(e, n, t, l, a, o) {
109
- return s(), f(T, {
110
- name: "fade-" + t.dir,
111
- appear: ""
112
- }, {
113
- default: b(() => [
114
- y("div", {
115
- class: p(["Bubble", [
116
- `Bubble-${t.dir}`,
117
- `Bubble-${t.align}`
118
- ]])
119
- }, [
120
- n[0] || (n[0] = y("div", { class: "Arrow" }, null, -1)),
121
- y("div", A, [
122
- u(e.$slots, "default", {}, void 0, !0)
123
- ])
124
- ], 2)
125
- ]),
126
- _: 3
127
- }, 8, ["name"]);
128
- }
129
- i(D, "_sfc_render$b");
130
- const O = /* @__PURE__ */ c(x, [["render", D], ["__scopeId", "data-v-2bf83119"]]), G = {
131
- props: {
132
- size: { type: String, default: "normal" }
133
- }
134
- };
135
- function F(e, n, t, l, a, o) {
136
- return s(), m("div", {
137
- class: p(["Circle", [
138
- `Circle-${t.size}`
139
- ]])
140
- }, [
141
- u(e.$slots, "default", {}, void 0, !0)
142
- ], 2);
143
- }
144
- i(F, "_sfc_render$a");
145
- const L = /* @__PURE__ */ c(G, [["render", F], ["__scopeId", "data-v-48fdb4ac"]]), M = {
146
- props: {
147
- dir: { type: String, default: "v" },
148
- align: { type: String, default: "auto" },
149
- anchorRef: { type: String },
150
- anchorDir: { type: String, default: "middle" },
151
- overlayEnabled: { type: Boolean, default: !0 },
152
- overlayShown: { type: Boolean, default: !0 }
153
- },
154
- emits: ["hide", "mouseenter", "mouseleave", "ready"],
155
- data() {
156
- return {
157
- pos: {
158
- x: 0,
159
- y: 0
160
- },
161
- actualDir: "bottom",
162
- actualAlign: "start",
163
- ready: !1
164
- };
165
- },
166
- computed: {
167
- bubbleStyle() {
168
- const { x: e, y: n } = this.pos;
169
- return {
170
- left: `${e}px`,
171
- top: `${n}px`,
172
- "pointer-events": "auto"
173
- };
174
- }
175
- },
176
- mounted() {
177
- this.$nextTick(() => this.calcPos()), window.addEventListener("resize", this.onResize), window.addEventListener("keydown", this.onWindowKeyDown), this.enableOverlay();
178
- },
179
- unmounted() {
180
- window.removeEventListener("resize", this.onResize), window.removeEventListener("keydown", this.onWindowKeyDown), this.disableOverlay();
181
- },
182
- methods: {
183
- hide() {
184
- this.$emit("hide");
185
- },
186
- calcPos() {
187
- const e = this.getAnchorEl();
188
- this.pos = N(e, this.anchorDir), this.calcDirAlign(), this.ready = !0, this.$nextTick(() => this.$emit("ready"));
189
- },
190
- calcDirAlign() {
191
- const e = this.pos.y < window.innerHeight * 0.5, n = this.pos.x < window.innerWidth * 0.5;
192
- this.align === "auto" ? ["top", "bottom", "v"].includes(this.dir) ? this.actualAlign = n ? "start" : "end" : this.actualAlign = e ? "start" : "end" : this.actualAlign = this.align, this.dir === "v" ? this.actualDir = e ? "bottom" : "top" : this.dir === "h" ? this.actualDir = n ? "right" : "left" : this.actualDir = this.dir;
193
- },
194
- getAnchorEl() {
195
- if (this.anchorRef) {
196
- const e = this.findRef(this.$parent, this.anchorRef);
197
- if (e)
198
- return e;
199
- }
200
- return this.$el.parentElement;
201
- },
202
- findRef(e, n) {
203
- const t = e.$refs[n];
204
- if (t) {
205
- const l = t.$el ?? t;
206
- if (l instanceof HTMLElement)
207
- return l;
208
- }
209
- return e.$parent ? this.findRef(e.$parent, n) : null;
210
- },
211
- onResize() {
212
- this.calcPos();
213
- },
214
- onWindowKeyDown(e) {
215
- e.key === "Escape" && this.hide();
216
- },
217
- enableOverlay() {
218
- if (!this.overlayEnabled)
219
- return;
220
- const e = document.documentElement, n = e.style.overflow;
221
- e.dataset.previousOverflow = n, e.style.overflow = "hidden";
222
- },
223
- disableOverlay() {
224
- const e = document.documentElement;
225
- e.dataset.previousOverflow != null && (e.style.overflow = e.dataset.previousOverflow, delete e.dataset.previousOverflow);
226
- }
227
- }
228
- };
229
- function P(e, n, t, l, a, o) {
230
- const r = v("Bubble");
231
- return s(), f(C, { to: "#overlays" }, [
232
- y("div", {
233
- class: p(["Overlay", {
234
- "Overlay-enabled": t.overlayEnabled,
235
- "Overlay-shown": t.overlayShown
236
- }]),
237
- onClick: n[3] || (n[3] = B((d) => o.hide(), ["stop"]))
238
- }, [
239
- a.ready ? (s(), f(r, {
240
- key: 0,
241
- dir: a.actualDir,
242
- align: a.actualAlign,
243
- style: z(o.bubbleStyle),
244
- onMouseenter: n[0] || (n[0] = (d) => e.$emit("mouseenter")),
245
- onMouseleave: n[1] || (n[1] = (d) => e.$emit("mouseleave")),
246
- onClick: n[2] || (n[2] = B(() => {
247
- }, ["stop"]))
248
- }, {
249
- default: b(() => [
250
- u(e.$slots, "default", {}, void 0, !0)
251
- ]),
252
- _: 3
253
- }, 8, ["dir", "align", "style"])) : h("", !0)
254
- ], 2)
255
- ]);
256
- }
257
- i(P, "_sfc_render$9");
258
- const j = /* @__PURE__ */ c(M, [["render", P], ["__scopeId", "data-v-573085ca"]]), K = {
259
- props: {
260
- tagName: { type: String, default: "div" },
261
- align: { type: String, default: "center" },
262
- justify: { type: String },
263
- gap: { type: String, default: "1" },
264
- wrap: { type: Boolean, default: !1 }
265
- }
266
- };
267
- function W(e, n, t, l, a, o) {
268
- return s(), f(_(t.tagName), {
269
- class: p(["HGroup", [
270
- `HGroup-align-${t.align}`,
271
- `HGroup-justify-${t.justify}`,
272
- `HGroup-gap-${t.gap}`,
273
- {
274
- "HGroup-wrap": t.wrap
275
- }
276
- ]])
277
- }, {
278
- default: b(() => [
279
- u(e.$slots, "default", {}, void 0, !0)
280
- ]),
281
- _: 3
282
- }, 8, ["class"]);
283
- }
284
- i(W, "_sfc_render$8");
285
- const q = /* @__PURE__ */ c(K, [["render", W], ["__scopeId", "data-v-0abfef17"]]), U = {}, J = { class: "HStack" };
286
- function Q(e, n, t, l, a, o) {
287
- return s(), m("div", J, [
288
- u(e.$slots, "default", {}, void 0, !0)
289
- ]);
290
- }
291
- i(Q, "_sfc_render$7");
292
- const X = /* @__PURE__ */ c(U, [["render", Q], ["__scopeId", "data-v-48a370d0"]]), Y = {
293
- props: {
294
- dir: { type: String, default: "top" },
295
- label: { type: String }
296
- },
297
- computed: {
298
- orientation() {
299
- return this.dir === "top" || this.dir === "bottom" ? "h" : "v";
300
- }
301
- }
302
- }, Z = { class: "Content" }, ee = ["title"];
303
- function te(e, n, t, l, a, o) {
304
- const r = v("TabCap");
305
- return s(), m("div", {
306
- class: p(["Tab", [
307
- `Tab-${t.dir}`,
308
- `Tab-${o.orientation}`
309
- ]])
310
- }, [
311
- $(r, {
312
- class: "TabCap",
313
- dir: t.dir,
314
- type: "start"
315
- }, null, 8, ["dir"]),
316
- y("div", Z, [
317
- u(e.$slots, "default", {}, () => [
318
- t.label ? (s(), m("div", {
319
- key: 0,
320
- class: "TabLabel",
321
- title: t.label
322
- }, S(t.label), 9, ee)) : h("", !0)
323
- ], !0)
324
- ]),
325
- $(r, {
326
- class: "TabCap",
327
- dir: t.dir,
328
- type: "end"
329
- }, null, 8, ["dir"])
330
- ], 2);
331
- }
332
- i(te, "_sfc_render$6");
333
- const I = /* @__PURE__ */ c(Y, [["render", te], ["__scopeId", "data-v-1ba502f2"]]), ne = {
334
- components: {
335
- Tab: I
336
- },
337
- props: {
338
- tagName: { default: "label" },
339
- label: { type: String },
340
- size: { type: String, default: "normal" },
341
- fixedHeight: { type: Boolean, default: !0 },
342
- round: { type: Boolean, default: !1 },
343
- block: { type: Boolean },
344
- disabled: { type: Boolean, default: !1 },
345
- invalid: { type: Boolean, default: !1 },
346
- pseudoFocus: { type: Boolean, default: !1 },
347
- pseudoHover: { type: Boolean, default: !1 }
348
- }
349
- }, ae = { class: "Container" };
350
- function oe(e, n, t, l, a, o) {
351
- const r = v("Tab");
352
- return s(), f(_(t.tagName), {
353
- class: p(["InputBase", [
354
- `InputBase-${t.size}`,
355
- {
356
- "InputBase-block": t.block,
357
- "InputBase-round": t.round,
358
- "InputBase-disabled": t.disabled,
359
- "InputBase-invalid": t.invalid,
360
- "InputBase-fixed-height": t.fixedHeight,
361
- "InputBase-pseudo-focus": t.pseudoFocus,
362
- "InputBase-pseudo-hover": t.pseudoHover
363
- }
364
- ]])
365
- }, {
366
- default: b(() => [
367
- t.label ? (s(), f(r, {
368
- key: 0,
369
- class: "Label",
370
- label: t.label
371
- }, null, 8, ["label"])) : h("", !0),
372
- y("div", ae, [
373
- u(e.$slots, "default", {}, void 0, !0)
374
- ])
375
- ]),
376
- _: 3
377
- }, 8, ["class"]);
378
- }
379
- i(oe, "_sfc_render$5");
380
- const g = /* @__PURE__ */ c(ne, [["render", oe], ["__scopeId", "data-v-6d7754d0"]]), se = {
381
- props: {
382
- ...g.props,
383
- modelValue: { type: [String, Number] },
384
- type: { type: String },
385
- placeholder: { type: String },
386
- min: { type: Number },
387
- max: { type: Number },
388
- step: { type: Number },
389
- autoFocus: { type: Boolean },
390
- readonly: { type: Boolean }
391
- },
392
- emits: [
393
- "focus",
394
- "blur",
395
- "input",
396
- "update:modelValue"
397
- ],
398
- mounted() {
399
- var e;
400
- this.autoFocus && ((e = this.$refs.input) == null || e.focus());
401
- },
402
- methods: {
403
- onInput(e) {
404
- this.$emit("update:modelValue", e.target.value);
405
- }
406
- }
407
- }, le = ["value", "type", "placeholder", "readonly", "disabled", "min", "max", "step"];
408
- function ie(e, n, t, l, a, o) {
409
- const r = v("InputBase");
410
- return s(), f(r, w({ class: "InputText" }, {
411
- ...e.$attrs,
412
- ...e.$props
413
- }), {
414
- default: b(() => [
415
- u(e.$slots, "before", {}, void 0, !0),
416
- y("input", {
417
- ref: "input",
418
- value: t.modelValue,
419
- type: t.type,
420
- placeholder: t.placeholder,
421
- readonly: t.readonly,
422
- disabled: e.disabled,
423
- min: t.min,
424
- max: t.max,
425
- step: t.step,
426
- autocomplete: "off",
427
- onInput: n[0] || (n[0] = (d) => o.onInput(d)),
428
- onFocus: n[1] || (n[1] = (d) => e.$emit("focus", d)),
429
- onBlur: n[2] || (n[2] = (d) => e.$emit("blur", d))
430
- }, null, 40, le),
431
- u(e.$slots, "after", {}, void 0, !0)
432
- ]),
433
- _: 3
434
- }, 16);
435
- }
436
- i(ie, "_sfc_render$4");
437
- const re = /* @__PURE__ */ c(se, [["render", ie], ["__scopeId", "data-v-26fed2ef"]]), de = {
438
- props: {
439
- ...g.props,
440
- modelValue: { type: [String, Number] },
441
- placeholder: { type: String },
442
- rows: { type: Number },
443
- autoSize: { type: Boolean, default: !0 },
444
- minRows: { type: Number, default: 2 },
445
- maxRows: { type: Number, default: 10 },
446
- autoFocus: { type: Boolean },
447
- readonly: { type: Boolean }
448
- },
449
- emits: [
450
- "focus",
451
- "blur",
452
- "input",
453
- "update:modelValue"
454
- ],
455
- computed: {
456
- effectiveRows() {
457
- if (this.autoSize) {
458
- const e = this.modelValue.split(`
459
- `).length;
460
- return Math.max(Math.min(e, this.maxRows), this.minRows);
461
- }
462
- return this.rows ?? this.minRows ?? 2;
463
- }
464
- },
465
- mounted() {
466
- var e;
467
- this.autoFocus && ((e = this.$refs.input) == null || e.focus());
468
- },
469
- methods: {
470
- onInput(e) {
471
- this.$emit("update:modelValue", e.target.value);
472
- }
473
- }
474
- }, ue = ["value", "placeholder", "readonly", "disabled", "rows"];
475
- function ce(e, n, t, l, a, o) {
476
- const r = v("InputBase");
477
- return s(), f(r, w({ class: "InputTextarea" }, {
478
- ...e.$attrs,
479
- ...e.$props
480
- }, { fixedHeight: !1 }), {
481
- default: b(() => [
482
- u(e.$slots, "before", {}, void 0, !0),
483
- y("textarea", {
484
- ref: "input",
485
- value: t.modelValue,
486
- placeholder: t.placeholder,
487
- readonly: t.readonly,
488
- disabled: e.disabled,
489
- rows: o.effectiveRows,
490
- resize: "none",
491
- autocomplete: "off",
492
- onInput: n[0] || (n[0] = (d) => o.onInput(d)),
493
- onFocus: n[1] || (n[1] = (d) => e.$emit("focus", d)),
494
- onBlur: n[2] || (n[2] = (d) => e.$emit("blur", d))
495
- }, null, 40, ue),
496
- u(e.$slots, "after", {}, void 0, !0)
497
- ]),
498
- _: 3
499
- }, 16);
500
- }
501
- i(ce, "_sfc_render$3");
502
- const fe = /* @__PURE__ */ c(de, [["render", ce], ["__scopeId", "data-v-76fc64e6"]]), pe = {}, ye = { class: "Sizer" };
503
- function me(e, n) {
504
- return s(), m("div", ye);
505
- }
506
- i(me, "_sfc_render$2");
507
- const be = /* @__PURE__ */ c(pe, [["render", me], ["__scopeId", "data-v-2f099547"]]), he = {
508
- props: {
509
- dir: { type: String, default: "top" },
510
- type: { type: String, default: "start" }
511
- }
512
- };
513
- function ve(e, n, t, l, a, o) {
514
- return s(), m("svg", {
515
- class: p(["TabCap", [
516
- `TabCap-${t.dir}`,
517
- `TabCap-${t.type}`
518
- ]]),
519
- viewBox: "0 0 32 32",
520
- preserveAspectRatio: "none"
521
- }, n[0] || (n[0] = [
522
- y("path", { d: "M0 32 C 16 32 16 0 32 0 L 32 32 z" }, null, -1)
523
- ]), 2);
524
- }
525
- i(ve, "_sfc_render$1");
526
- const _e = /* @__PURE__ */ c(he, [["render", ve], ["__scopeId", "data-v-3c0176d0"]]), ge = {
527
- props: {
528
- tagName: { type: String, default: "div" },
529
- align: { type: String, default: "stretch" },
530
- justify: { type: String },
531
- gap: { type: String, default: "1" }
532
- }
533
- };
534
- function Be(e, n, t, l, a, o) {
535
- return s(), f(_(t.tagName), {
536
- class: p(["VGroup", [
537
- `VGroup-align-${t.align}`,
538
- `VGroup-justify-${t.justify}`,
539
- `VGroup-gap-${t.gap}`
540
- ]])
541
- }, {
542
- default: b(() => [
543
- u(e.$slots, "default", {}, void 0, !0)
544
- ]),
545
- _: 3
546
- }, 8, ["class"]);
547
- }
548
- i(Be, "_sfc_render");
549
- const $e = /* @__PURE__ */ c(ge, [["render", Be], ["__scopeId", "data-v-4e4be270"]]), ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
550
- __proto__: null,
551
- Btn: R,
552
- Bubble: O,
553
- Circle: L,
554
- ContextPopup: j,
555
- HGroup: q,
556
- HStack: X,
557
- InputBase: g,
558
- InputText: re,
559
- InputTextarea: fe,
560
- Sizer: be,
561
- Tab: I,
562
- TabCap: _e,
563
- VGroup: $e
564
- }, Symbol.toStringTag, { value: "Module" }));
565
- export {
566
- R as B,
567
- L as C,
568
- q as H,
569
- g as I,
570
- be as S,
571
- I as T,
572
- $e as V,
573
- O as a,
574
- j as b,
575
- X as c,
576
- re as d,
577
- fe as e,
578
- _e as f,
579
- ke as i
580
- };