@bagelink/vue 0.0.1214 → 0.0.1218
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/components/Draggable/useDraggable.d.ts.map +1 -1
- package/dist/components/dialog/index.d.ts +1 -18
- package/dist/components/dialog/index.d.ts.map +1 -1
- package/dist/index.cjs +74 -58
- package/dist/index.mjs +74 -58
- package/package.json +1 -1
- package/src/components/Calendar/Index.vue +0 -0
- package/src/components/Dialog/index.ts +192 -0
- package/src/components/Draggable/useDraggable.ts +53 -37
- package/src/components/dialog/index.ts +0 -192
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDraggable.d.ts","sourceRoot":"","sources":["../../../src/components/Draggable/useDraggable.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAe,SAAQ,UAAU;IACjD,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,GAAG,CAAA;CACV;AAED,MAAM,WAAW,gBAAgB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,KAAK,CAAC,EAAE,GAAG,EAAE,CAAA;IACb,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;IACrC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAA;CACvC;AAED,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACpD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,WAAW,CAAC,EAAE,GAAG,CAAA;CACjB;AAED,wBAAgB,YAAY,CAAC,OAAO,GAAE,gBAAqB;;;
|
|
1
|
+
{"version":3,"file":"useDraggable.d.ts","sourceRoot":"","sources":["../../../src/components/Draggable/useDraggable.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAe,SAAQ,UAAU;IACjD,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,GAAG,CAAA;CACV;AAED,MAAM,WAAW,gBAAgB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,KAAK,CAAC,EAAE,GAAG,EAAE,CAAA;IACb,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;IACrC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAA;CACvC;AAED,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACpD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,WAAW,CAAC,EAAE,GAAG,CAAA;CACjB;AAED,wBAAgB,YAAY,CAAC,OAAO,GAAE,gBAAqB;;;wCA8iBf,WAAW;EA2DtD"}
|
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export interface DialogOptions {
|
|
3
|
-
title?: string;
|
|
4
|
-
content?: string | Component;
|
|
5
|
-
dismissable?: boolean;
|
|
6
|
-
width?: string;
|
|
7
|
-
actions?: Array<{
|
|
8
|
-
label: string;
|
|
9
|
-
onClick: () => void;
|
|
10
|
-
variant?: 'primary' | 'secondary' | 'danger';
|
|
11
|
-
}>;
|
|
12
|
-
}
|
|
13
|
-
export interface DialogApi {
|
|
14
|
-
show: (options: DialogOptions) => void;
|
|
15
|
-
hide: () => void;
|
|
16
|
-
}
|
|
17
|
-
export declare function useDialog(): DialogApi;
|
|
18
|
-
export declare const DialogPlugin: Plugin;
|
|
1
|
+
export {};
|
|
19
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/index.ts"],"names":[],"mappings":""}
|
package/dist/index.cjs
CHANGED
|
@@ -5506,21 +5506,21 @@ function styleInject(css2, ref) {
|
|
|
5506
5506
|
return;
|
|
5507
5507
|
}
|
|
5508
5508
|
var head = document.head || document.getElementsByTagName("head")[0];
|
|
5509
|
-
var
|
|
5510
|
-
|
|
5509
|
+
var style = document.createElement("style");
|
|
5510
|
+
style.type = "text/css";
|
|
5511
5511
|
if (insertAt === "top") {
|
|
5512
5512
|
if (head.firstChild) {
|
|
5513
|
-
head.insertBefore(
|
|
5513
|
+
head.insertBefore(style, head.firstChild);
|
|
5514
5514
|
} else {
|
|
5515
|
-
head.appendChild(
|
|
5515
|
+
head.appendChild(style);
|
|
5516
5516
|
}
|
|
5517
5517
|
} else {
|
|
5518
|
-
head.appendChild(
|
|
5518
|
+
head.appendChild(style);
|
|
5519
5519
|
}
|
|
5520
|
-
if (
|
|
5521
|
-
|
|
5520
|
+
if (style.styleSheet) {
|
|
5521
|
+
style.styleSheet.cssText = css2;
|
|
5522
5522
|
} else {
|
|
5523
|
-
|
|
5523
|
+
style.appendChild(document.createTextNode(css2));
|
|
5524
5524
|
}
|
|
5525
5525
|
}
|
|
5526
5526
|
var css_248z$1 = "\n.chart {\n position: relative;\n}\n";
|
|
@@ -5694,8 +5694,8 @@ var script$9 = vue.defineComponent({
|
|
|
5694
5694
|
}
|
|
5695
5695
|
function computeDotStyle(active) {
|
|
5696
5696
|
const dotStyle = props2.dotStyle;
|
|
5697
|
-
const
|
|
5698
|
-
return Object.assign({ r: active ? 5 : 3, stroke:
|
|
5697
|
+
const style = getStyle.value();
|
|
5698
|
+
return Object.assign({ r: active ? 5 : 3, stroke: style.stroke, strokeWidth: style.strokeWidth, fill: "white" }, dotStyle);
|
|
5699
5699
|
}
|
|
5700
5700
|
const getStyle = vue.computed(() => {
|
|
5701
5701
|
if (is$1(Function, props2.lineStyle)) {
|
|
@@ -5898,11 +5898,11 @@ var script$7 = vue.defineComponent({
|
|
|
5898
5898
|
const getStyle = vue.computed(() => {
|
|
5899
5899
|
return () => Object.assign({ colors: ["#4daf4a", "#377eb8", "#ff7f00", "#984ea3", "#e41a1c"], innerRadius: 2, cornerRadius: 0, padAngle: 0.01 }, props2.pieStyle);
|
|
5900
5900
|
});
|
|
5901
|
-
const
|
|
5901
|
+
const style = getStyle.value();
|
|
5902
5902
|
const arcs = vue.ref([]);
|
|
5903
5903
|
const colors = ordinal(getStyle.value().colors);
|
|
5904
5904
|
const arcGen = () => {
|
|
5905
|
-
return arc().outerRadius(size2.value).innerRadius(
|
|
5905
|
+
return arc().outerRadius(size2.value).innerRadius(style.innerRadius).cornerRadius(style.cornerRadius).padAngle(style.padAngle);
|
|
5906
5906
|
};
|
|
5907
5907
|
const transform = vue.ref(`translate(${size2.value + chart.canvas.x}, ${size2.value + chart.canvas.y})`);
|
|
5908
5908
|
let pieSort;
|
|
@@ -6185,7 +6185,7 @@ var script$4 = vue.defineComponent({
|
|
|
6185
6185
|
const isRight = vue.computed(() => {
|
|
6186
6186
|
return position.value.x >= canvas.value.width / 4 * 3;
|
|
6187
6187
|
});
|
|
6188
|
-
const
|
|
6188
|
+
const style = vue.computed(() => {
|
|
6189
6189
|
if (direction.value === "vertical") {
|
|
6190
6190
|
return {
|
|
6191
6191
|
top: position.value.y - 0.5 + "px",
|
|
@@ -6241,7 +6241,7 @@ var script$4 = vue.defineComponent({
|
|
|
6241
6241
|
direction.value = chart.config.direction;
|
|
6242
6242
|
canvas.value = chart.canvas;
|
|
6243
6243
|
});
|
|
6244
|
-
return { el, show, canvas, direction, style
|
|
6244
|
+
return { el, show, canvas, direction, style, styleContent, position, items, isRight };
|
|
6245
6245
|
}
|
|
6246
6246
|
});
|
|
6247
6247
|
const _hoisted_1$3$1 = { key: 0 };
|
|
@@ -6981,16 +6981,16 @@ var script$1 = vue.defineComponent({
|
|
|
6981
6981
|
}
|
|
6982
6982
|
const toKebabCase = (data3) => mapKeys(kebabize, data3);
|
|
6983
6983
|
const getStyle = (r2) => {
|
|
6984
|
-
const
|
|
6984
|
+
const style = {
|
|
6985
6985
|
stroke: r2.color,
|
|
6986
6986
|
strokeWidth: 5,
|
|
6987
6987
|
fill: r2.color,
|
|
6988
6988
|
fillOpacity: 0.9
|
|
6989
6989
|
};
|
|
6990
6990
|
if (props2.rcStyle && typeof props2.rcStyle === "function") {
|
|
6991
|
-
return Object.assign(Object.assign({},
|
|
6991
|
+
return Object.assign(Object.assign({}, style), props2.rcStyle(r2));
|
|
6992
6992
|
}
|
|
6993
|
-
return
|
|
6993
|
+
return style;
|
|
6994
6994
|
};
|
|
6995
6995
|
function onMouseOver(i2) {
|
|
6996
6996
|
selected.value = i2;
|
|
@@ -8394,6 +8394,22 @@ function useDraggable(options = {}) {
|
|
|
8394
8394
|
const ghostElement = vue.ref(null);
|
|
8395
8395
|
const dropIndicator = vue.ref(null);
|
|
8396
8396
|
const dropTarget = vue.ref(null);
|
|
8397
|
+
const isBrowser = typeof window !== "undefined";
|
|
8398
|
+
if (isBrowser) {
|
|
8399
|
+
const existingStyle = document.getElementById("draggable-style");
|
|
8400
|
+
if (!existingStyle) {
|
|
8401
|
+
const style = document.createElement("style");
|
|
8402
|
+
style.id = "draggable-style";
|
|
8403
|
+
style.textContent = `
|
|
8404
|
+
.draggable-ghost {
|
|
8405
|
+
opacity: 0.5;
|
|
8406
|
+
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
8407
|
+
transition: transform 0.1s;
|
|
8408
|
+
}
|
|
8409
|
+
`;
|
|
8410
|
+
document.head.appendChild(style);
|
|
8411
|
+
}
|
|
8412
|
+
}
|
|
8397
8413
|
const defaultOptions2 = {
|
|
8398
8414
|
animation: 150,
|
|
8399
8415
|
mode: "line",
|
|
@@ -8414,6 +8430,7 @@ function useDraggable(options = {}) {
|
|
|
8414
8430
|
const UPDATE_THRESHOLD = 150;
|
|
8415
8431
|
const POSITION_CACHE = /* @__PURE__ */ new Map();
|
|
8416
8432
|
function createGhost(el) {
|
|
8433
|
+
if (!isBrowser) return null;
|
|
8417
8434
|
const ghost = el.cloneNode(true);
|
|
8418
8435
|
const rect = el.getBoundingClientRect();
|
|
8419
8436
|
ghost.style.position = "fixed";
|
|
@@ -8432,6 +8449,7 @@ function useDraggable(options = {}) {
|
|
|
8432
8449
|
return ghost;
|
|
8433
8450
|
}
|
|
8434
8451
|
function createDropIndicator(el) {
|
|
8452
|
+
if (!isBrowser) return null;
|
|
8435
8453
|
const line2 = document.createElement("div");
|
|
8436
8454
|
line2.classList.add(defaultOptions2.dropIndicatorClass);
|
|
8437
8455
|
line2.style.position = "fixed";
|
|
@@ -8527,6 +8545,7 @@ function useDraggable(options = {}) {
|
|
|
8527
8545
|
return dropIndex;
|
|
8528
8546
|
}
|
|
8529
8547
|
function cleanup() {
|
|
8548
|
+
if (!isBrowser) return;
|
|
8530
8549
|
document.removeEventListener("mousemove", onDragMove);
|
|
8531
8550
|
document.removeEventListener("mouseup", onDragEnd);
|
|
8532
8551
|
document.removeEventListener("keydown", onKeyDown);
|
|
@@ -8563,9 +8582,11 @@ function useDraggable(options = {}) {
|
|
|
8563
8582
|
}
|
|
8564
8583
|
isDragging.value = false;
|
|
8565
8584
|
dropTarget.value = null;
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8585
|
+
if (isBrowser) {
|
|
8586
|
+
document.body.style.userSelect = "";
|
|
8587
|
+
document.body.style.webkitUserSelect = "";
|
|
8588
|
+
document.body.style.cursor = "";
|
|
8589
|
+
}
|
|
8569
8590
|
if (scrollRAF) {
|
|
8570
8591
|
cancelAnimationFrame(scrollRAF);
|
|
8571
8592
|
scrollRAF = null;
|
|
@@ -8581,7 +8602,7 @@ function useDraggable(options = {}) {
|
|
|
8581
8602
|
}
|
|
8582
8603
|
function onDragStart(e) {
|
|
8583
8604
|
var _a2;
|
|
8584
|
-
if (defaultOptions2.disabled) return;
|
|
8605
|
+
if (!isBrowser || defaultOptions2.disabled) return;
|
|
8585
8606
|
if (e.button !== 0) return;
|
|
8586
8607
|
if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey) return;
|
|
8587
8608
|
const dragEl2 = findDraggableParent(e.target);
|
|
@@ -8609,13 +8630,15 @@ function useDraggable(options = {}) {
|
|
|
8609
8630
|
dragEl2.classList.add(defaultOptions2.dragClass);
|
|
8610
8631
|
shiftAmount = defaultOptions2.mode === "ghost" ? handleGhostMode(dragEl2) : handleLineMode(dragEl2);
|
|
8611
8632
|
(_a2 = defaultOptions2.onStart) == null ? void 0 : _a2.call(defaultOptions2, e);
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8633
|
+
if (isBrowser) {
|
|
8634
|
+
document.body.style.userSelect = "none";
|
|
8635
|
+
document.body.style.webkitUserSelect = "none";
|
|
8636
|
+
document.body.style.cursor = "grabbing";
|
|
8637
|
+
window.addEventListener("blur", cleanup);
|
|
8638
|
+
document.addEventListener("mousemove", onDragMove);
|
|
8639
|
+
document.addEventListener("mouseup", onDragEnd);
|
|
8640
|
+
document.addEventListener("keydown", onKeyDown);
|
|
8641
|
+
}
|
|
8619
8642
|
}
|
|
8620
8643
|
function findScrollParent(element) {
|
|
8621
8644
|
let parent = element.parentElement;
|
|
@@ -8728,7 +8751,7 @@ function useDraggable(options = {}) {
|
|
|
8728
8751
|
}
|
|
8729
8752
|
function onTouchStart(e) {
|
|
8730
8753
|
var _a2;
|
|
8731
|
-
if (defaultOptions2.disabled || !e.target) return;
|
|
8754
|
+
if (!isBrowser || defaultOptions2.disabled || !e.target) return;
|
|
8732
8755
|
const touch = e.touches[0];
|
|
8733
8756
|
if (!touch) return;
|
|
8734
8757
|
const target = e.target;
|
|
@@ -8755,13 +8778,15 @@ function useDraggable(options = {}) {
|
|
|
8755
8778
|
dragElement.value.classList.add(defaultOptions2.dragClass);
|
|
8756
8779
|
shiftAmount = defaultOptions2.mode === "ghost" ? handleGhostMode(dragElement.value) : handleLineMode(dragElement.value);
|
|
8757
8780
|
(_a2 = defaultOptions2.onStart) == null ? void 0 : _a2.call(defaultOptions2, e);
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
8781
|
+
if (isBrowser) {
|
|
8782
|
+
document.body.style.userSelect = "none";
|
|
8783
|
+
document.body.style.webkitUserSelect = "none";
|
|
8784
|
+
document.body.style.cursor = "grabbing";
|
|
8785
|
+
window.addEventListener("blur", cleanup);
|
|
8786
|
+
document.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
8787
|
+
document.addEventListener("touchend", onTouchEnd);
|
|
8788
|
+
document.addEventListener("touchcancel", onTouchEnd);
|
|
8789
|
+
}
|
|
8765
8790
|
}
|
|
8766
8791
|
function onTouchMove(e) {
|
|
8767
8792
|
e.preventDefault();
|
|
@@ -8789,6 +8814,7 @@ function useDraggable(options = {}) {
|
|
|
8789
8814
|
document.removeEventListener("touchcancel", onTouchEnd);
|
|
8790
8815
|
}
|
|
8791
8816
|
function initDraggableContainer(container) {
|
|
8817
|
+
if (!isBrowser) return;
|
|
8792
8818
|
cleanupFn == null ? void 0 : cleanupFn();
|
|
8793
8819
|
isDragging.value = false;
|
|
8794
8820
|
dragElement.value = null;
|
|
@@ -8836,16 +8862,6 @@ function useDraggable(options = {}) {
|
|
|
8836
8862
|
initDraggableContainer
|
|
8837
8863
|
};
|
|
8838
8864
|
}
|
|
8839
|
-
const style = document.createElement("style");
|
|
8840
|
-
style.textContent = `
|
|
8841
|
-
.draggable-ghost {
|
|
8842
|
-
opacity: 0.5;
|
|
8843
|
-
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
8844
|
-
transition: transform 0.1s;
|
|
8845
|
-
|
|
8846
|
-
}
|
|
8847
|
-
`;
|
|
8848
|
-
document.head.appendChild(style);
|
|
8849
8865
|
const _sfc_main$V = /* @__PURE__ */ vue.defineComponent({
|
|
8850
8866
|
__name: "Draggable",
|
|
8851
8867
|
props: {
|
|
@@ -22592,7 +22608,7 @@ function createCommandExecutor(state2, commands) {
|
|
|
22592
22608
|
}
|
|
22593
22609
|
};
|
|
22594
22610
|
}
|
|
22595
|
-
function isStyleActive(
|
|
22611
|
+
function isStyleActive(style, doc) {
|
|
22596
22612
|
const selection = doc.getSelection();
|
|
22597
22613
|
if (!selection || !selection.rangeCount) return false;
|
|
22598
22614
|
const range2 = selection.getRangeAt(0);
|
|
@@ -22609,7 +22625,7 @@ function isStyleActive(style2, doc) {
|
|
|
22609
22625
|
italic: ["em", "i"],
|
|
22610
22626
|
underline: ["u"]
|
|
22611
22627
|
};
|
|
22612
|
-
return checkParent(parent, styleTags[
|
|
22628
|
+
return checkParent(parent, styleTags[style] ?? [style]);
|
|
22613
22629
|
}
|
|
22614
22630
|
function analyzeSelection(doc, range2) {
|
|
22615
22631
|
const container = range2.commonAncestorContainer;
|
|
@@ -23163,9 +23179,9 @@ function useEditor() {
|
|
|
23163
23179
|
"ol",
|
|
23164
23180
|
"li"
|
|
23165
23181
|
];
|
|
23166
|
-
styleTypes.forEach((
|
|
23167
|
-
if (state2.doc && isStyleActive(
|
|
23168
|
-
styles.add(
|
|
23182
|
+
styleTypes.forEach((style) => {
|
|
23183
|
+
if (state2.doc && isStyleActive(style, state2.doc)) {
|
|
23184
|
+
styles.add(style);
|
|
23169
23185
|
}
|
|
23170
23186
|
});
|
|
23171
23187
|
state2.selectedStyles = styles;
|
|
@@ -23526,9 +23542,9 @@ const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
|
|
|
23526
23542
|
doc.designMode = "on";
|
|
23527
23543
|
doc.body.contentEditable = "true";
|
|
23528
23544
|
doc.body.dir = hasRTL.value ? "rtl" : "ltr";
|
|
23529
|
-
const
|
|
23530
|
-
|
|
23531
|
-
doc.head.appendChild(
|
|
23545
|
+
const style = doc.createElement("style");
|
|
23546
|
+
style.textContent = (await Promise.resolve().then(() => require("./editor-B3mMCQSg.cjs"))).default;
|
|
23547
|
+
doc.head.appendChild(style);
|
|
23532
23548
|
editor.init(doc);
|
|
23533
23549
|
useEditorKeyboard(doc, commands.execute);
|
|
23534
23550
|
if (!doc.body.firstElementChild) {
|
|
@@ -24908,8 +24924,8 @@ function toggleClass(el, name, state2) {
|
|
|
24908
24924
|
}
|
|
24909
24925
|
}
|
|
24910
24926
|
function css(el, prop3, val) {
|
|
24911
|
-
var
|
|
24912
|
-
if (
|
|
24927
|
+
var style = el && el.style;
|
|
24928
|
+
if (style) {
|
|
24913
24929
|
if (val === void 0) {
|
|
24914
24930
|
if (document.defaultView && document.defaultView.getComputedStyle) {
|
|
24915
24931
|
val = document.defaultView.getComputedStyle(el, "");
|
|
@@ -24918,10 +24934,10 @@ function css(el, prop3, val) {
|
|
|
24918
24934
|
}
|
|
24919
24935
|
return prop3 === void 0 ? val : val[prop3];
|
|
24920
24936
|
} else {
|
|
24921
|
-
if (!(prop3 in
|
|
24937
|
+
if (!(prop3 in style) && prop3.indexOf("webkit") === -1) {
|
|
24922
24938
|
prop3 = "-webkit-" + prop3;
|
|
24923
24939
|
}
|
|
24924
|
-
|
|
24940
|
+
style[prop3] = val + (typeof val === "string" ? "" : "px");
|
|
24925
24941
|
}
|
|
24926
24942
|
}
|
|
24927
24943
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -5504,21 +5504,21 @@ function styleInject(css2, ref2) {
|
|
|
5504
5504
|
return;
|
|
5505
5505
|
}
|
|
5506
5506
|
var head = document.head || document.getElementsByTagName("head")[0];
|
|
5507
|
-
var
|
|
5508
|
-
|
|
5507
|
+
var style = document.createElement("style");
|
|
5508
|
+
style.type = "text/css";
|
|
5509
5509
|
if (insertAt === "top") {
|
|
5510
5510
|
if (head.firstChild) {
|
|
5511
|
-
head.insertBefore(
|
|
5511
|
+
head.insertBefore(style, head.firstChild);
|
|
5512
5512
|
} else {
|
|
5513
|
-
head.appendChild(
|
|
5513
|
+
head.appendChild(style);
|
|
5514
5514
|
}
|
|
5515
5515
|
} else {
|
|
5516
|
-
head.appendChild(
|
|
5516
|
+
head.appendChild(style);
|
|
5517
5517
|
}
|
|
5518
|
-
if (
|
|
5519
|
-
|
|
5518
|
+
if (style.styleSheet) {
|
|
5519
|
+
style.styleSheet.cssText = css2;
|
|
5520
5520
|
} else {
|
|
5521
|
-
|
|
5521
|
+
style.appendChild(document.createTextNode(css2));
|
|
5522
5522
|
}
|
|
5523
5523
|
}
|
|
5524
5524
|
var css_248z$1 = "\n.chart {\n position: relative;\n}\n";
|
|
@@ -5692,8 +5692,8 @@ var script$9 = defineComponent({
|
|
|
5692
5692
|
}
|
|
5693
5693
|
function computeDotStyle(active) {
|
|
5694
5694
|
const dotStyle = props2.dotStyle;
|
|
5695
|
-
const
|
|
5696
|
-
return Object.assign({ r: active ? 5 : 3, stroke:
|
|
5695
|
+
const style = getStyle.value();
|
|
5696
|
+
return Object.assign({ r: active ? 5 : 3, stroke: style.stroke, strokeWidth: style.strokeWidth, fill: "white" }, dotStyle);
|
|
5697
5697
|
}
|
|
5698
5698
|
const getStyle = computed(() => {
|
|
5699
5699
|
if (is$1(Function, props2.lineStyle)) {
|
|
@@ -5896,11 +5896,11 @@ var script$7 = defineComponent({
|
|
|
5896
5896
|
const getStyle = computed(() => {
|
|
5897
5897
|
return () => Object.assign({ colors: ["#4daf4a", "#377eb8", "#ff7f00", "#984ea3", "#e41a1c"], innerRadius: 2, cornerRadius: 0, padAngle: 0.01 }, props2.pieStyle);
|
|
5898
5898
|
});
|
|
5899
|
-
const
|
|
5899
|
+
const style = getStyle.value();
|
|
5900
5900
|
const arcs = ref([]);
|
|
5901
5901
|
const colors = ordinal(getStyle.value().colors);
|
|
5902
5902
|
const arcGen = () => {
|
|
5903
|
-
return arc().outerRadius(size2.value).innerRadius(
|
|
5903
|
+
return arc().outerRadius(size2.value).innerRadius(style.innerRadius).cornerRadius(style.cornerRadius).padAngle(style.padAngle);
|
|
5904
5904
|
};
|
|
5905
5905
|
const transform = ref(`translate(${size2.value + chart.canvas.x}, ${size2.value + chart.canvas.y})`);
|
|
5906
5906
|
let pieSort;
|
|
@@ -6183,7 +6183,7 @@ var script$4 = defineComponent({
|
|
|
6183
6183
|
const isRight = computed(() => {
|
|
6184
6184
|
return position.value.x >= canvas.value.width / 4 * 3;
|
|
6185
6185
|
});
|
|
6186
|
-
const
|
|
6186
|
+
const style = computed(() => {
|
|
6187
6187
|
if (direction.value === "vertical") {
|
|
6188
6188
|
return {
|
|
6189
6189
|
top: position.value.y - 0.5 + "px",
|
|
@@ -6239,7 +6239,7 @@ var script$4 = defineComponent({
|
|
|
6239
6239
|
direction.value = chart.config.direction;
|
|
6240
6240
|
canvas.value = chart.canvas;
|
|
6241
6241
|
});
|
|
6242
|
-
return { el, show, canvas, direction, style
|
|
6242
|
+
return { el, show, canvas, direction, style, styleContent, position, items, isRight };
|
|
6243
6243
|
}
|
|
6244
6244
|
});
|
|
6245
6245
|
const _hoisted_1$3$1 = { key: 0 };
|
|
@@ -6979,16 +6979,16 @@ var script$1 = defineComponent({
|
|
|
6979
6979
|
}
|
|
6980
6980
|
const toKebabCase = (data3) => mapKeys(kebabize, data3);
|
|
6981
6981
|
const getStyle = (r2) => {
|
|
6982
|
-
const
|
|
6982
|
+
const style = {
|
|
6983
6983
|
stroke: r2.color,
|
|
6984
6984
|
strokeWidth: 5,
|
|
6985
6985
|
fill: r2.color,
|
|
6986
6986
|
fillOpacity: 0.9
|
|
6987
6987
|
};
|
|
6988
6988
|
if (props2.rcStyle && typeof props2.rcStyle === "function") {
|
|
6989
|
-
return Object.assign(Object.assign({},
|
|
6989
|
+
return Object.assign(Object.assign({}, style), props2.rcStyle(r2));
|
|
6990
6990
|
}
|
|
6991
|
-
return
|
|
6991
|
+
return style;
|
|
6992
6992
|
};
|
|
6993
6993
|
function onMouseOver(i2) {
|
|
6994
6994
|
selected.value = i2;
|
|
@@ -8392,6 +8392,22 @@ function useDraggable(options = {}) {
|
|
|
8392
8392
|
const ghostElement = ref(null);
|
|
8393
8393
|
const dropIndicator = ref(null);
|
|
8394
8394
|
const dropTarget = ref(null);
|
|
8395
|
+
const isBrowser = typeof window !== "undefined";
|
|
8396
|
+
if (isBrowser) {
|
|
8397
|
+
const existingStyle = document.getElementById("draggable-style");
|
|
8398
|
+
if (!existingStyle) {
|
|
8399
|
+
const style = document.createElement("style");
|
|
8400
|
+
style.id = "draggable-style";
|
|
8401
|
+
style.textContent = `
|
|
8402
|
+
.draggable-ghost {
|
|
8403
|
+
opacity: 0.5;
|
|
8404
|
+
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
8405
|
+
transition: transform 0.1s;
|
|
8406
|
+
}
|
|
8407
|
+
`;
|
|
8408
|
+
document.head.appendChild(style);
|
|
8409
|
+
}
|
|
8410
|
+
}
|
|
8395
8411
|
const defaultOptions2 = {
|
|
8396
8412
|
animation: 150,
|
|
8397
8413
|
mode: "line",
|
|
@@ -8412,6 +8428,7 @@ function useDraggable(options = {}) {
|
|
|
8412
8428
|
const UPDATE_THRESHOLD = 150;
|
|
8413
8429
|
const POSITION_CACHE = /* @__PURE__ */ new Map();
|
|
8414
8430
|
function createGhost(el) {
|
|
8431
|
+
if (!isBrowser) return null;
|
|
8415
8432
|
const ghost = el.cloneNode(true);
|
|
8416
8433
|
const rect = el.getBoundingClientRect();
|
|
8417
8434
|
ghost.style.position = "fixed";
|
|
@@ -8430,6 +8447,7 @@ function useDraggable(options = {}) {
|
|
|
8430
8447
|
return ghost;
|
|
8431
8448
|
}
|
|
8432
8449
|
function createDropIndicator(el) {
|
|
8450
|
+
if (!isBrowser) return null;
|
|
8433
8451
|
const line2 = document.createElement("div");
|
|
8434
8452
|
line2.classList.add(defaultOptions2.dropIndicatorClass);
|
|
8435
8453
|
line2.style.position = "fixed";
|
|
@@ -8525,6 +8543,7 @@ function useDraggable(options = {}) {
|
|
|
8525
8543
|
return dropIndex;
|
|
8526
8544
|
}
|
|
8527
8545
|
function cleanup() {
|
|
8546
|
+
if (!isBrowser) return;
|
|
8528
8547
|
document.removeEventListener("mousemove", onDragMove);
|
|
8529
8548
|
document.removeEventListener("mouseup", onDragEnd);
|
|
8530
8549
|
document.removeEventListener("keydown", onKeyDown);
|
|
@@ -8561,9 +8580,11 @@ function useDraggable(options = {}) {
|
|
|
8561
8580
|
}
|
|
8562
8581
|
isDragging.value = false;
|
|
8563
8582
|
dropTarget.value = null;
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8583
|
+
if (isBrowser) {
|
|
8584
|
+
document.body.style.userSelect = "";
|
|
8585
|
+
document.body.style.webkitUserSelect = "";
|
|
8586
|
+
document.body.style.cursor = "";
|
|
8587
|
+
}
|
|
8567
8588
|
if (scrollRAF) {
|
|
8568
8589
|
cancelAnimationFrame(scrollRAF);
|
|
8569
8590
|
scrollRAF = null;
|
|
@@ -8579,7 +8600,7 @@ function useDraggable(options = {}) {
|
|
|
8579
8600
|
}
|
|
8580
8601
|
function onDragStart(e) {
|
|
8581
8602
|
var _a2;
|
|
8582
|
-
if (defaultOptions2.disabled) return;
|
|
8603
|
+
if (!isBrowser || defaultOptions2.disabled) return;
|
|
8583
8604
|
if (e.button !== 0) return;
|
|
8584
8605
|
if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey) return;
|
|
8585
8606
|
const dragEl2 = findDraggableParent(e.target);
|
|
@@ -8607,13 +8628,15 @@ function useDraggable(options = {}) {
|
|
|
8607
8628
|
dragEl2.classList.add(defaultOptions2.dragClass);
|
|
8608
8629
|
shiftAmount = defaultOptions2.mode === "ghost" ? handleGhostMode(dragEl2) : handleLineMode(dragEl2);
|
|
8609
8630
|
(_a2 = defaultOptions2.onStart) == null ? void 0 : _a2.call(defaultOptions2, e);
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8631
|
+
if (isBrowser) {
|
|
8632
|
+
document.body.style.userSelect = "none";
|
|
8633
|
+
document.body.style.webkitUserSelect = "none";
|
|
8634
|
+
document.body.style.cursor = "grabbing";
|
|
8635
|
+
window.addEventListener("blur", cleanup);
|
|
8636
|
+
document.addEventListener("mousemove", onDragMove);
|
|
8637
|
+
document.addEventListener("mouseup", onDragEnd);
|
|
8638
|
+
document.addEventListener("keydown", onKeyDown);
|
|
8639
|
+
}
|
|
8617
8640
|
}
|
|
8618
8641
|
function findScrollParent(element) {
|
|
8619
8642
|
let parent = element.parentElement;
|
|
@@ -8726,7 +8749,7 @@ function useDraggable(options = {}) {
|
|
|
8726
8749
|
}
|
|
8727
8750
|
function onTouchStart(e) {
|
|
8728
8751
|
var _a2;
|
|
8729
|
-
if (defaultOptions2.disabled || !e.target) return;
|
|
8752
|
+
if (!isBrowser || defaultOptions2.disabled || !e.target) return;
|
|
8730
8753
|
const touch = e.touches[0];
|
|
8731
8754
|
if (!touch) return;
|
|
8732
8755
|
const target = e.target;
|
|
@@ -8753,13 +8776,15 @@ function useDraggable(options = {}) {
|
|
|
8753
8776
|
dragElement.value.classList.add(defaultOptions2.dragClass);
|
|
8754
8777
|
shiftAmount = defaultOptions2.mode === "ghost" ? handleGhostMode(dragElement.value) : handleLineMode(dragElement.value);
|
|
8755
8778
|
(_a2 = defaultOptions2.onStart) == null ? void 0 : _a2.call(defaultOptions2, e);
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8779
|
+
if (isBrowser) {
|
|
8780
|
+
document.body.style.userSelect = "none";
|
|
8781
|
+
document.body.style.webkitUserSelect = "none";
|
|
8782
|
+
document.body.style.cursor = "grabbing";
|
|
8783
|
+
window.addEventListener("blur", cleanup);
|
|
8784
|
+
document.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
8785
|
+
document.addEventListener("touchend", onTouchEnd);
|
|
8786
|
+
document.addEventListener("touchcancel", onTouchEnd);
|
|
8787
|
+
}
|
|
8763
8788
|
}
|
|
8764
8789
|
function onTouchMove(e) {
|
|
8765
8790
|
e.preventDefault();
|
|
@@ -8787,6 +8812,7 @@ function useDraggable(options = {}) {
|
|
|
8787
8812
|
document.removeEventListener("touchcancel", onTouchEnd);
|
|
8788
8813
|
}
|
|
8789
8814
|
function initDraggableContainer(container) {
|
|
8815
|
+
if (!isBrowser) return;
|
|
8790
8816
|
cleanupFn == null ? void 0 : cleanupFn();
|
|
8791
8817
|
isDragging.value = false;
|
|
8792
8818
|
dragElement.value = null;
|
|
@@ -8834,16 +8860,6 @@ function useDraggable(options = {}) {
|
|
|
8834
8860
|
initDraggableContainer
|
|
8835
8861
|
};
|
|
8836
8862
|
}
|
|
8837
|
-
const style = document.createElement("style");
|
|
8838
|
-
style.textContent = `
|
|
8839
|
-
.draggable-ghost {
|
|
8840
|
-
opacity: 0.5;
|
|
8841
|
-
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
8842
|
-
transition: transform 0.1s;
|
|
8843
|
-
|
|
8844
|
-
}
|
|
8845
|
-
`;
|
|
8846
|
-
document.head.appendChild(style);
|
|
8847
8863
|
const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
8848
8864
|
__name: "Draggable",
|
|
8849
8865
|
props: {
|
|
@@ -22590,7 +22606,7 @@ function createCommandExecutor(state2, commands) {
|
|
|
22590
22606
|
}
|
|
22591
22607
|
};
|
|
22592
22608
|
}
|
|
22593
|
-
function isStyleActive(
|
|
22609
|
+
function isStyleActive(style, doc) {
|
|
22594
22610
|
const selection = doc.getSelection();
|
|
22595
22611
|
if (!selection || !selection.rangeCount) return false;
|
|
22596
22612
|
const range2 = selection.getRangeAt(0);
|
|
@@ -22607,7 +22623,7 @@ function isStyleActive(style2, doc) {
|
|
|
22607
22623
|
italic: ["em", "i"],
|
|
22608
22624
|
underline: ["u"]
|
|
22609
22625
|
};
|
|
22610
|
-
return checkParent(parent, styleTags[
|
|
22626
|
+
return checkParent(parent, styleTags[style] ?? [style]);
|
|
22611
22627
|
}
|
|
22612
22628
|
function analyzeSelection(doc, range2) {
|
|
22613
22629
|
const container = range2.commonAncestorContainer;
|
|
@@ -23161,9 +23177,9 @@ function useEditor() {
|
|
|
23161
23177
|
"ol",
|
|
23162
23178
|
"li"
|
|
23163
23179
|
];
|
|
23164
|
-
styleTypes.forEach((
|
|
23165
|
-
if (state2.doc && isStyleActive(
|
|
23166
|
-
styles.add(
|
|
23180
|
+
styleTypes.forEach((style) => {
|
|
23181
|
+
if (state2.doc && isStyleActive(style, state2.doc)) {
|
|
23182
|
+
styles.add(style);
|
|
23167
23183
|
}
|
|
23168
23184
|
});
|
|
23169
23185
|
state2.selectedStyles = styles;
|
|
@@ -23524,9 +23540,9 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
23524
23540
|
doc.designMode = "on";
|
|
23525
23541
|
doc.body.contentEditable = "true";
|
|
23526
23542
|
doc.body.dir = hasRTL.value ? "rtl" : "ltr";
|
|
23527
|
-
const
|
|
23528
|
-
|
|
23529
|
-
doc.head.appendChild(
|
|
23543
|
+
const style = doc.createElement("style");
|
|
23544
|
+
style.textContent = (await import("./editor-BKPRpAjr.js")).default;
|
|
23545
|
+
doc.head.appendChild(style);
|
|
23530
23546
|
editor.init(doc);
|
|
23531
23547
|
useEditorKeyboard(doc, commands.execute);
|
|
23532
23548
|
if (!doc.body.firstElementChild) {
|
|
@@ -24906,8 +24922,8 @@ function toggleClass(el, name, state2) {
|
|
|
24906
24922
|
}
|
|
24907
24923
|
}
|
|
24908
24924
|
function css(el, prop3, val) {
|
|
24909
|
-
var
|
|
24910
|
-
if (
|
|
24925
|
+
var style = el && el.style;
|
|
24926
|
+
if (style) {
|
|
24911
24927
|
if (val === void 0) {
|
|
24912
24928
|
if (document.defaultView && document.defaultView.getComputedStyle) {
|
|
24913
24929
|
val = document.defaultView.getComputedStyle(el, "");
|
|
@@ -24916,10 +24932,10 @@ function css(el, prop3, val) {
|
|
|
24916
24932
|
}
|
|
24917
24933
|
return prop3 === void 0 ? val : val[prop3];
|
|
24918
24934
|
} else {
|
|
24919
|
-
if (!(prop3 in
|
|
24935
|
+
if (!(prop3 in style) && prop3.indexOf("webkit") === -1) {
|
|
24920
24936
|
prop3 = "-webkit-" + prop3;
|
|
24921
24937
|
}
|
|
24922
|
-
|
|
24938
|
+
style[prop3] = val + (typeof val === "string" ? "" : "px");
|
|
24923
24939
|
}
|
|
24924
24940
|
}
|
|
24925
24941
|
}
|
package/package.json
CHANGED
|
File without changes
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
// import type { App, Component, InjectionKey, Plugin, PropType } from 'vue'
|
|
2
|
+
// import { createApp, defineComponent, h, inject } from 'vue'
|
|
3
|
+
|
|
4
|
+
// export interface DialogOptions {
|
|
5
|
+
// title?: string
|
|
6
|
+
// content?: string | Component
|
|
7
|
+
// dismissable?: boolean
|
|
8
|
+
// width?: string
|
|
9
|
+
// actions?: Array<{
|
|
10
|
+
// label: string
|
|
11
|
+
// onClick: () => void
|
|
12
|
+
// variant?: 'primary' | 'secondary' | 'danger'
|
|
13
|
+
// }>
|
|
14
|
+
// }
|
|
15
|
+
|
|
16
|
+
// export interface DialogApi {
|
|
17
|
+
// show: (options: DialogOptions) => void
|
|
18
|
+
// hide: () => void
|
|
19
|
+
// }
|
|
20
|
+
|
|
21
|
+
// const DialogSymbol: InjectionKey<DialogApi> = Symbol('dialog')
|
|
22
|
+
|
|
23
|
+
// export function useDialog(): DialogApi {
|
|
24
|
+
// const api = inject(DialogSymbol)
|
|
25
|
+
// if (!api) throw new Error('Dialog plugin not installed')
|
|
26
|
+
// return api
|
|
27
|
+
// }
|
|
28
|
+
|
|
29
|
+
// const Dialog = defineComponent({
|
|
30
|
+
// props: {
|
|
31
|
+
// options: {
|
|
32
|
+
// type: Object as () => DialogOptions,
|
|
33
|
+
// required: true
|
|
34
|
+
// },
|
|
35
|
+
// onClose: {
|
|
36
|
+
// type: Function as PropType<(event?: MouseEvent) => void>,
|
|
37
|
+
// required: true
|
|
38
|
+
// }
|
|
39
|
+
// },
|
|
40
|
+
// setup(props) {
|
|
41
|
+
// return () => h('div', {
|
|
42
|
+
// class: 'dialog-overlay',
|
|
43
|
+
// onClick: (e: MouseEvent) => {
|
|
44
|
+
// if (props.options.dismissable && e.target === e.currentTarget) {
|
|
45
|
+
// props.onClose()
|
|
46
|
+
// }
|
|
47
|
+
// }
|
|
48
|
+
// }, [
|
|
49
|
+
// h('div', {
|
|
50
|
+
// class: ['dialog', props.options.width ? `w-${props.options.width}` : 'w-96']
|
|
51
|
+
// }, [
|
|
52
|
+
// h('div', { class: 'dialog-header' }, [
|
|
53
|
+
// h('h3', { class: 'dialog-title' }, props.options.title),
|
|
54
|
+
// props.options.dismissable && h('button', {
|
|
55
|
+
// class: 'dialog-close',
|
|
56
|
+
// onClick: props.onClose
|
|
57
|
+
// }, '×')
|
|
58
|
+
// ]),
|
|
59
|
+
// h('div', { class: 'dialog-content' }, [
|
|
60
|
+
// typeof props.options.content === 'string'
|
|
61
|
+
// ? props.options.content
|
|
62
|
+
// : h(props.options.content as any)
|
|
63
|
+
// ]),
|
|
64
|
+
// props.options.actions && h('div', { class: 'dialog-actions' }, props.options.actions.map(action => h('button', {
|
|
65
|
+
// class: ['dialog-btn', action.variant],
|
|
66
|
+
// onClick: () => {
|
|
67
|
+
// action.onClick()
|
|
68
|
+
// props.onClose()
|
|
69
|
+
// }
|
|
70
|
+
// }, action.label)
|
|
71
|
+
// ))
|
|
72
|
+
// ])
|
|
73
|
+
// ])
|
|
74
|
+
// }
|
|
75
|
+
// })
|
|
76
|
+
|
|
77
|
+
// export const DialogPlugin: Plugin = {
|
|
78
|
+
// install: (app: App) => {
|
|
79
|
+
// // Create a div to mount our dialog
|
|
80
|
+
// const dialogContainer = document.createElement('div')
|
|
81
|
+
// document.body.appendChild(dialogContainer)
|
|
82
|
+
|
|
83
|
+
// let currentDialog: any = null
|
|
84
|
+
|
|
85
|
+
// const api: DialogApi = {
|
|
86
|
+
// show: (options: DialogOptions) => {
|
|
87
|
+
// // Remove existing dialog if any
|
|
88
|
+
// if (currentDialog) {
|
|
89
|
+
// currentDialog.unmount()
|
|
90
|
+
// }
|
|
91
|
+
|
|
92
|
+
// // Create new dialog instance
|
|
93
|
+
// const dialogApp = createApp(Dialog, {
|
|
94
|
+
// options,
|
|
95
|
+
// onClose: () => { api.hide() }
|
|
96
|
+
// })
|
|
97
|
+
|
|
98
|
+
// // Mount it
|
|
99
|
+
// currentDialog = dialogApp.mount(dialogContainer)
|
|
100
|
+
// },
|
|
101
|
+
// hide: () => {
|
|
102
|
+
// if (currentDialog) {
|
|
103
|
+
// currentDialog.unmount()
|
|
104
|
+
// currentDialog = null
|
|
105
|
+
// }
|
|
106
|
+
// }
|
|
107
|
+
// }
|
|
108
|
+
|
|
109
|
+
// app.provide(DialogSymbol, api)
|
|
110
|
+
// }
|
|
111
|
+
// }
|
|
112
|
+
|
|
113
|
+
// // Add some basic styles
|
|
114
|
+
// const style = document.createElement('style')
|
|
115
|
+
// style.textContent = `
|
|
116
|
+
// .dialog-overlay {
|
|
117
|
+
// position: fixed;
|
|
118
|
+
// top: 0;
|
|
119
|
+
// left: 0;
|
|
120
|
+
// right: 0;
|
|
121
|
+
// bottom: 0;
|
|
122
|
+
// background: rgba(0, 0, 0, 0.5);
|
|
123
|
+
// display: flex;
|
|
124
|
+
// align-items: center;
|
|
125
|
+
// justify-content: center;
|
|
126
|
+
// z-index: 1000;
|
|
127
|
+
// }
|
|
128
|
+
|
|
129
|
+
// .dialog {
|
|
130
|
+
// background: white;
|
|
131
|
+
// border-radius: 0.5rem;
|
|
132
|
+
// box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
133
|
+
// max-width: 90vw;
|
|
134
|
+
// max-height: 90vh;
|
|
135
|
+
// overflow: auto;
|
|
136
|
+
// }
|
|
137
|
+
|
|
138
|
+
// .dialog-header {
|
|
139
|
+
// padding: 1rem;
|
|
140
|
+
// border-bottom: 1px solid #e5e7eb;
|
|
141
|
+
// display: flex;
|
|
142
|
+
// justify-content: space-between;
|
|
143
|
+
// align-items: center;
|
|
144
|
+
// }
|
|
145
|
+
|
|
146
|
+
// .dialog-title {
|
|
147
|
+
// margin: 0;
|
|
148
|
+
// font-size: 1.25rem;
|
|
149
|
+
// font-weight: 600;
|
|
150
|
+
// }
|
|
151
|
+
|
|
152
|
+
// .dialog-close {
|
|
153
|
+
// background: none;
|
|
154
|
+
// border: none;
|
|
155
|
+
// font-size: 1.5rem;
|
|
156
|
+
// cursor: pointer;
|
|
157
|
+
// padding: 0.25rem;
|
|
158
|
+
// }
|
|
159
|
+
|
|
160
|
+
// .dialog-content {
|
|
161
|
+
// padding: 1rem;
|
|
162
|
+
// }
|
|
163
|
+
|
|
164
|
+
// .dialog-actions {
|
|
165
|
+
// padding: 1rem;
|
|
166
|
+
// border-top: 1px solid #e5e7eb;
|
|
167
|
+
// display: flex;
|
|
168
|
+
// justify-content: flex-end;
|
|
169
|
+
// gap: 0.5rem;
|
|
170
|
+
// }
|
|
171
|
+
|
|
172
|
+
// .dialog-btn {
|
|
173
|
+
// padding: 0.5rem 1rem;
|
|
174
|
+
// border-radius: 0.375rem;
|
|
175
|
+
// border: 1px solid #e5e7eb;
|
|
176
|
+
// background: white;
|
|
177
|
+
// cursor: pointer;
|
|
178
|
+
// }
|
|
179
|
+
|
|
180
|
+
// .dialog-btn.primary {
|
|
181
|
+
// background: #3b82f6;
|
|
182
|
+
// color: white;
|
|
183
|
+
// border-color: #3b82f6;
|
|
184
|
+
// }
|
|
185
|
+
|
|
186
|
+
// .dialog-btn.danger {
|
|
187
|
+
// background: #ef4444;
|
|
188
|
+
// color: white;
|
|
189
|
+
// border-color: #ef4444;
|
|
190
|
+
// }
|
|
191
|
+
// `
|
|
192
|
+
// document.head.appendChild(style)
|
|
@@ -35,6 +35,26 @@ export function useDraggable(options: DraggableOptions = {}) {
|
|
|
35
35
|
const dropIndicator = ref<HTMLElement | null>(null)
|
|
36
36
|
const dropTarget = ref<DraggableElement | null>(null)
|
|
37
37
|
|
|
38
|
+
// Only run in browser environment
|
|
39
|
+
const isBrowser = typeof window !== 'undefined'
|
|
40
|
+
|
|
41
|
+
// Move style injection into setup
|
|
42
|
+
if (isBrowser) {
|
|
43
|
+
const existingStyle = document.getElementById('draggable-style')
|
|
44
|
+
if (!existingStyle) {
|
|
45
|
+
const style = document.createElement('style')
|
|
46
|
+
style.id = 'draggable-style'
|
|
47
|
+
style.textContent = `
|
|
48
|
+
.draggable-ghost {
|
|
49
|
+
opacity: 0.5;
|
|
50
|
+
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
51
|
+
transition: transform 0.1s;
|
|
52
|
+
}
|
|
53
|
+
`
|
|
54
|
+
document.head.appendChild(style)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
38
58
|
const defaultOptions: DraggableOptions = {
|
|
39
59
|
animation: 150,
|
|
40
60
|
mode: 'line',
|
|
@@ -59,6 +79,7 @@ export function useDraggable(options: DraggableOptions = {}) {
|
|
|
59
79
|
const POSITION_CACHE = new Map<number, { top: number, bottom: number }>()
|
|
60
80
|
|
|
61
81
|
function createGhost(el: DraggableElement) {
|
|
82
|
+
if (!isBrowser) return null
|
|
62
83
|
const ghost = el.cloneNode(true) as HTMLElement
|
|
63
84
|
const rect = el.getBoundingClientRect()
|
|
64
85
|
ghost.style.position = 'fixed'
|
|
@@ -78,6 +99,7 @@ export function useDraggable(options: DraggableOptions = {}) {
|
|
|
78
99
|
}
|
|
79
100
|
|
|
80
101
|
function createDropIndicator(el: DraggableElement) {
|
|
102
|
+
if (!isBrowser) return null
|
|
81
103
|
const line = document.createElement('div')
|
|
82
104
|
line.classList.add(defaultOptions.dropIndicatorClass!)
|
|
83
105
|
line.style.position = 'fixed'
|
|
@@ -212,6 +234,8 @@ export function useDraggable(options: DraggableOptions = {}) {
|
|
|
212
234
|
}
|
|
213
235
|
|
|
214
236
|
function cleanup() {
|
|
237
|
+
if (!isBrowser) return
|
|
238
|
+
|
|
215
239
|
document.removeEventListener('mousemove', onDragMove)
|
|
216
240
|
document.removeEventListener('mouseup', onDragEnd)
|
|
217
241
|
document.removeEventListener('keydown', onKeyDown)
|
|
@@ -252,9 +276,12 @@ export function useDraggable(options: DraggableOptions = {}) {
|
|
|
252
276
|
|
|
253
277
|
isDragging.value = false
|
|
254
278
|
dropTarget.value = null
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
279
|
+
|
|
280
|
+
if (isBrowser) {
|
|
281
|
+
document.body.style.userSelect = ''
|
|
282
|
+
document.body.style.webkitUserSelect = ''
|
|
283
|
+
document.body.style.cursor = ''
|
|
284
|
+
}
|
|
258
285
|
|
|
259
286
|
if (scrollRAF) {
|
|
260
287
|
cancelAnimationFrame(scrollRAF)
|
|
@@ -273,7 +300,7 @@ export function useDraggable(options: DraggableOptions = {}) {
|
|
|
273
300
|
}
|
|
274
301
|
|
|
275
302
|
function onDragStart(e: MouseEvent) {
|
|
276
|
-
if (defaultOptions.disabled) return
|
|
303
|
+
if (!isBrowser || defaultOptions.disabled) return
|
|
277
304
|
if (e.button !== 0) return // Only left mouse button
|
|
278
305
|
if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey) return
|
|
279
306
|
|
|
@@ -318,16 +345,16 @@ export function useDraggable(options: DraggableOptions = {}) {
|
|
|
318
345
|
defaultOptions.onStart?.(e)
|
|
319
346
|
|
|
320
347
|
// Prevent text selection during drag
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
348
|
+
if (isBrowser) {
|
|
349
|
+
document.body.style.userSelect = 'none'
|
|
350
|
+
document.body.style.webkitUserSelect = 'none'
|
|
351
|
+
document.body.style.cursor = 'grabbing'
|
|
352
|
+
|
|
353
|
+
window.addEventListener('blur', cleanup)
|
|
354
|
+
document.addEventListener('mousemove', onDragMove)
|
|
355
|
+
document.addEventListener('mouseup', onDragEnd)
|
|
356
|
+
document.addEventListener('keydown', onKeyDown)
|
|
357
|
+
}
|
|
331
358
|
}
|
|
332
359
|
|
|
333
360
|
function findScrollParent(element: Element): Element {
|
|
@@ -472,7 +499,7 @@ export function useDraggable(options: DraggableOptions = {}) {
|
|
|
472
499
|
}
|
|
473
500
|
|
|
474
501
|
function onTouchStart(e: TouchEvent) {
|
|
475
|
-
if (defaultOptions.disabled || !e.target) return
|
|
502
|
+
if (!isBrowser || defaultOptions.disabled || !e.target) return
|
|
476
503
|
|
|
477
504
|
const touch = e.touches[0]
|
|
478
505
|
if (!touch) return
|
|
@@ -515,17 +542,17 @@ export function useDraggable(options: DraggableOptions = {}) {
|
|
|
515
542
|
|
|
516
543
|
defaultOptions.onStart?.(e as unknown as MouseEvent)
|
|
517
544
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
545
|
+
if (isBrowser) {
|
|
546
|
+
// Prevent text selection during drag
|
|
547
|
+
document.body.style.userSelect = 'none'
|
|
548
|
+
document.body.style.webkitUserSelect = 'none'
|
|
549
|
+
document.body.style.cursor = 'grabbing'
|
|
521
550
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
document.addEventListener('touchend', onTouchEnd)
|
|
528
|
-
document.addEventListener('touchcancel', onTouchEnd)
|
|
551
|
+
window.addEventListener('blur', cleanup)
|
|
552
|
+
document.addEventListener('touchmove', onTouchMove, { passive: false })
|
|
553
|
+
document.addEventListener('touchend', onTouchEnd)
|
|
554
|
+
document.addEventListener('touchcancel', onTouchEnd)
|
|
555
|
+
}
|
|
529
556
|
}
|
|
530
557
|
|
|
531
558
|
function onTouchMove(e: TouchEvent) {
|
|
@@ -560,6 +587,7 @@ export function useDraggable(options: DraggableOptions = {}) {
|
|
|
560
587
|
}
|
|
561
588
|
|
|
562
589
|
function initDraggableContainer(container: HTMLElement) {
|
|
590
|
+
if (!isBrowser) return
|
|
563
591
|
cleanupFn?.()
|
|
564
592
|
|
|
565
593
|
// Reset state
|
|
@@ -618,15 +646,3 @@ export function useDraggable(options: DraggableOptions = {}) {
|
|
|
618
646
|
initDraggableContainer
|
|
619
647
|
}
|
|
620
648
|
}
|
|
621
|
-
|
|
622
|
-
// Simplified default styles
|
|
623
|
-
const style = document.createElement('style')
|
|
624
|
-
style.textContent = `
|
|
625
|
-
.draggable-ghost {
|
|
626
|
-
opacity: 0.5;
|
|
627
|
-
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
628
|
-
transition: transform 0.1s;
|
|
629
|
-
|
|
630
|
-
}
|
|
631
|
-
`
|
|
632
|
-
document.head.appendChild(style)
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import type { App, Component, InjectionKey, Plugin, PropType } from 'vue'
|
|
2
|
-
import { createApp, defineComponent, h, inject } from 'vue'
|
|
3
|
-
|
|
4
|
-
export interface DialogOptions {
|
|
5
|
-
title?: string
|
|
6
|
-
content?: string | Component
|
|
7
|
-
dismissable?: boolean
|
|
8
|
-
width?: string
|
|
9
|
-
actions?: Array<{
|
|
10
|
-
label: string
|
|
11
|
-
onClick: () => void
|
|
12
|
-
variant?: 'primary' | 'secondary' | 'danger'
|
|
13
|
-
}>
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface DialogApi {
|
|
17
|
-
show: (options: DialogOptions) => void
|
|
18
|
-
hide: () => void
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const DialogSymbol: InjectionKey<DialogApi> = Symbol('dialog')
|
|
22
|
-
|
|
23
|
-
export function useDialog(): DialogApi {
|
|
24
|
-
const api = inject(DialogSymbol)
|
|
25
|
-
if (!api) throw new Error('Dialog plugin not installed')
|
|
26
|
-
return api
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const Dialog = defineComponent({
|
|
30
|
-
props: {
|
|
31
|
-
options: {
|
|
32
|
-
type: Object as () => DialogOptions,
|
|
33
|
-
required: true
|
|
34
|
-
},
|
|
35
|
-
onClose: {
|
|
36
|
-
type: Function as PropType<(event?: MouseEvent) => void>,
|
|
37
|
-
required: true
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
setup(props) {
|
|
41
|
-
return () => h('div', {
|
|
42
|
-
class: 'dialog-overlay',
|
|
43
|
-
onClick: (e: MouseEvent) => {
|
|
44
|
-
if (props.options.dismissable && e.target === e.currentTarget) {
|
|
45
|
-
props.onClose()
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}, [
|
|
49
|
-
h('div', {
|
|
50
|
-
class: ['dialog', props.options.width ? `w-${props.options.width}` : 'w-96']
|
|
51
|
-
}, [
|
|
52
|
-
h('div', { class: 'dialog-header' }, [
|
|
53
|
-
h('h3', { class: 'dialog-title' }, props.options.title),
|
|
54
|
-
props.options.dismissable && h('button', {
|
|
55
|
-
class: 'dialog-close',
|
|
56
|
-
onClick: props.onClose
|
|
57
|
-
}, '×')
|
|
58
|
-
]),
|
|
59
|
-
h('div', { class: 'dialog-content' }, [
|
|
60
|
-
typeof props.options.content === 'string'
|
|
61
|
-
? props.options.content
|
|
62
|
-
: h(props.options.content as any)
|
|
63
|
-
]),
|
|
64
|
-
props.options.actions && h('div', { class: 'dialog-actions' }, props.options.actions.map(action => h('button', {
|
|
65
|
-
class: ['dialog-btn', action.variant],
|
|
66
|
-
onClick: () => {
|
|
67
|
-
action.onClick()
|
|
68
|
-
props.onClose()
|
|
69
|
-
}
|
|
70
|
-
}, action.label)
|
|
71
|
-
))
|
|
72
|
-
])
|
|
73
|
-
])
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
export const DialogPlugin: Plugin = {
|
|
78
|
-
install: (app: App) => {
|
|
79
|
-
// Create a div to mount our dialog
|
|
80
|
-
const dialogContainer = document.createElement('div')
|
|
81
|
-
document.body.appendChild(dialogContainer)
|
|
82
|
-
|
|
83
|
-
let currentDialog: any = null
|
|
84
|
-
|
|
85
|
-
const api: DialogApi = {
|
|
86
|
-
show: (options: DialogOptions) => {
|
|
87
|
-
// Remove existing dialog if any
|
|
88
|
-
if (currentDialog) {
|
|
89
|
-
currentDialog.unmount()
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Create new dialog instance
|
|
93
|
-
const dialogApp = createApp(Dialog, {
|
|
94
|
-
options,
|
|
95
|
-
onClose: () => { api.hide() }
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
// Mount it
|
|
99
|
-
currentDialog = dialogApp.mount(dialogContainer)
|
|
100
|
-
},
|
|
101
|
-
hide: () => {
|
|
102
|
-
if (currentDialog) {
|
|
103
|
-
currentDialog.unmount()
|
|
104
|
-
currentDialog = null
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
app.provide(DialogSymbol, api)
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Add some basic styles
|
|
114
|
-
const style = document.createElement('style')
|
|
115
|
-
style.textContent = `
|
|
116
|
-
.dialog-overlay {
|
|
117
|
-
position: fixed;
|
|
118
|
-
top: 0;
|
|
119
|
-
left: 0;
|
|
120
|
-
right: 0;
|
|
121
|
-
bottom: 0;
|
|
122
|
-
background: rgba(0, 0, 0, 0.5);
|
|
123
|
-
display: flex;
|
|
124
|
-
align-items: center;
|
|
125
|
-
justify-content: center;
|
|
126
|
-
z-index: 1000;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.dialog {
|
|
130
|
-
background: white;
|
|
131
|
-
border-radius: 0.5rem;
|
|
132
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
133
|
-
max-width: 90vw;
|
|
134
|
-
max-height: 90vh;
|
|
135
|
-
overflow: auto;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.dialog-header {
|
|
139
|
-
padding: 1rem;
|
|
140
|
-
border-bottom: 1px solid #e5e7eb;
|
|
141
|
-
display: flex;
|
|
142
|
-
justify-content: space-between;
|
|
143
|
-
align-items: center;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
.dialog-title {
|
|
147
|
-
margin: 0;
|
|
148
|
-
font-size: 1.25rem;
|
|
149
|
-
font-weight: 600;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.dialog-close {
|
|
153
|
-
background: none;
|
|
154
|
-
border: none;
|
|
155
|
-
font-size: 1.5rem;
|
|
156
|
-
cursor: pointer;
|
|
157
|
-
padding: 0.25rem;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.dialog-content {
|
|
161
|
-
padding: 1rem;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.dialog-actions {
|
|
165
|
-
padding: 1rem;
|
|
166
|
-
border-top: 1px solid #e5e7eb;
|
|
167
|
-
display: flex;
|
|
168
|
-
justify-content: flex-end;
|
|
169
|
-
gap: 0.5rem;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.dialog-btn {
|
|
173
|
-
padding: 0.5rem 1rem;
|
|
174
|
-
border-radius: 0.375rem;
|
|
175
|
-
border: 1px solid #e5e7eb;
|
|
176
|
-
background: white;
|
|
177
|
-
cursor: pointer;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.dialog-btn.primary {
|
|
181
|
-
background: #3b82f6;
|
|
182
|
-
color: white;
|
|
183
|
-
border-color: #3b82f6;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.dialog-btn.danger {
|
|
187
|
-
background: #ef4444;
|
|
188
|
-
color: white;
|
|
189
|
-
border-color: #ef4444;
|
|
190
|
-
}
|
|
191
|
-
`
|
|
192
|
-
document.head.appendChild(style)
|