@cck-ui/core 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/splitter/grip-icon.cjs +66 -0
- package/cjs/components/splitter/grip-icon.cjs.map +1 -0
- package/cjs/components/splitter/index.cjs +18 -0
- package/cjs/components/splitter/index.cjs.map +1 -0
- package/cjs/components/splitter/splitter-pane/splitter-pane.cjs +411 -0
- package/cjs/components/splitter/splitter-pane/splitter-pane.cjs.map +1 -0
- package/cjs/components/splitter/splitter.cjs +620 -0
- package/cjs/components/splitter/splitter.cjs.map +1 -0
- package/cjs/components/splitter/splitter.context.cjs +17 -0
- package/cjs/components/splitter/splitter.context.cjs.map +1 -0
- package/cjs/components/splitter/splitter.module.cjs +12 -0
- package/cjs/components/splitter/splitter.module.cjs.map +1 -0
- package/cjs/components/splitter/splitter.utils.cjs +12 -0
- package/cjs/components/splitter/splitter.utils.cjs.map +1 -0
- package/cjs/index.cjs +10 -6
- package/cjs/index.cjs.map +1 -1
- package/esm/components/splitter/grip-icon.mjs +66 -0
- package/esm/components/splitter/grip-icon.mjs.map +1 -0
- package/esm/components/splitter/index.mjs +16 -0
- package/esm/components/splitter/index.mjs.map +1 -0
- package/esm/components/splitter/splitter-pane/splitter-pane.mjs +411 -0
- package/esm/components/splitter/splitter-pane/splitter-pane.mjs.map +1 -0
- package/esm/components/splitter/splitter.context.mjs +16 -0
- package/esm/components/splitter/splitter.context.mjs.map +1 -0
- package/esm/components/splitter/splitter.mjs +620 -0
- package/esm/components/splitter/splitter.mjs.map +1 -0
- package/esm/components/splitter/splitter.module.mjs +12 -0
- package/esm/components/splitter/splitter.module.mjs.map +1 -0
- package/esm/components/splitter/splitter.utils.mjs +13 -0
- package/esm/components/splitter/splitter.utils.mjs.map +1 -0
- package/esm/index.mjs +3 -1
- package/esm/index.mjs.map +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/splitter/index.d.ts +11 -0
- package/lib/components/splitter/splitter-pane/splitter-pane.types.d.ts +47 -0
- package/lib/components/splitter/splitter.context.d.ts +13 -0
- package/lib/components/splitter/splitter.types.d.ts +77 -0
- package/lib/components/splitter/splitter.utils.d.ts +6 -0
- package/package.json +1 -1
- package/styles/splitter.css +76 -0
- package/styles/splitter.layer.css +77 -0
- package/styles.css +77 -0
- package/styles.layer.css +77 -0
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_export_helper = require("../../_virtual/_/plugin-vue/export-helper.cjs");
|
|
3
|
+
const require_use_component_props = require("../../core/config-provider/use-component-props/use-component-props.cjs");
|
|
4
|
+
const require_index = require("../../core/box/index.cjs");
|
|
5
|
+
const require_use_styles = require("../../core/styles-api/use-styles/use-styles.cjs");
|
|
6
|
+
const require_splitter_module = require("./splitter.module.cjs");
|
|
7
|
+
const require_splitter_utils = require("./splitter.utils.cjs");
|
|
8
|
+
const require_splitter_context = require("./splitter.context.cjs");
|
|
9
|
+
const require_splitter_pane = require("./splitter-pane/splitter-pane.cjs");
|
|
10
|
+
const require_grip_icon = require("./grip-icon.cjs");
|
|
11
|
+
let vue = require("vue");
|
|
12
|
+
let _cck_ui_hooks = require("@cck-ui/hooks");
|
|
13
|
+
//#region packages/@cck-ui/core/src/components/splitter/splitter.vue
|
|
14
|
+
const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
|
|
15
|
+
name: "CSplitter",
|
|
16
|
+
__name: "splitter",
|
|
17
|
+
props: {
|
|
18
|
+
orientation: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: false
|
|
21
|
+
},
|
|
22
|
+
sizes: {
|
|
23
|
+
type: Array,
|
|
24
|
+
required: false
|
|
25
|
+
},
|
|
26
|
+
onSizeChange: {
|
|
27
|
+
type: Function,
|
|
28
|
+
required: false
|
|
29
|
+
},
|
|
30
|
+
onResizeStart: {
|
|
31
|
+
type: Function,
|
|
32
|
+
required: false
|
|
33
|
+
},
|
|
34
|
+
onResizeEnd: {
|
|
35
|
+
type: Function,
|
|
36
|
+
required: false
|
|
37
|
+
},
|
|
38
|
+
onCollapseChange: {
|
|
39
|
+
type: Function,
|
|
40
|
+
required: false
|
|
41
|
+
},
|
|
42
|
+
redistribute: {
|
|
43
|
+
type: [String, Function],
|
|
44
|
+
required: false
|
|
45
|
+
},
|
|
46
|
+
step: {
|
|
47
|
+
type: null,
|
|
48
|
+
required: false
|
|
49
|
+
},
|
|
50
|
+
shiftStep: {
|
|
51
|
+
type: null,
|
|
52
|
+
required: false
|
|
53
|
+
},
|
|
54
|
+
lineSize: {
|
|
55
|
+
type: [Number, String],
|
|
56
|
+
required: false
|
|
57
|
+
},
|
|
58
|
+
handleColor: {
|
|
59
|
+
type: null,
|
|
60
|
+
required: false
|
|
61
|
+
},
|
|
62
|
+
handleIcon: {
|
|
63
|
+
type: null,
|
|
64
|
+
required: false
|
|
65
|
+
},
|
|
66
|
+
withHandle: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
required: false
|
|
69
|
+
},
|
|
70
|
+
resetOnDoubleClick: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
required: false
|
|
73
|
+
},
|
|
74
|
+
className: {
|
|
75
|
+
type: String,
|
|
76
|
+
required: false
|
|
77
|
+
},
|
|
78
|
+
style: {
|
|
79
|
+
type: [
|
|
80
|
+
Object,
|
|
81
|
+
Function,
|
|
82
|
+
Array
|
|
83
|
+
],
|
|
84
|
+
required: false,
|
|
85
|
+
skipCheck: true
|
|
86
|
+
},
|
|
87
|
+
__vars: {
|
|
88
|
+
type: null,
|
|
89
|
+
required: false
|
|
90
|
+
},
|
|
91
|
+
__size: {
|
|
92
|
+
type: String,
|
|
93
|
+
required: false
|
|
94
|
+
},
|
|
95
|
+
hiddenFrom: {
|
|
96
|
+
type: null,
|
|
97
|
+
required: false
|
|
98
|
+
},
|
|
99
|
+
visibleFrom: {
|
|
100
|
+
type: null,
|
|
101
|
+
required: false
|
|
102
|
+
},
|
|
103
|
+
lightHidden: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
required: false
|
|
106
|
+
},
|
|
107
|
+
darkHidden: {
|
|
108
|
+
type: Boolean,
|
|
109
|
+
required: false
|
|
110
|
+
},
|
|
111
|
+
mod: {
|
|
112
|
+
type: [
|
|
113
|
+
Object,
|
|
114
|
+
String,
|
|
115
|
+
Array
|
|
116
|
+
],
|
|
117
|
+
required: false
|
|
118
|
+
},
|
|
119
|
+
m: {
|
|
120
|
+
type: null,
|
|
121
|
+
required: false
|
|
122
|
+
},
|
|
123
|
+
my: {
|
|
124
|
+
type: null,
|
|
125
|
+
required: false
|
|
126
|
+
},
|
|
127
|
+
mx: {
|
|
128
|
+
type: null,
|
|
129
|
+
required: false
|
|
130
|
+
},
|
|
131
|
+
mt: {
|
|
132
|
+
type: null,
|
|
133
|
+
required: false
|
|
134
|
+
},
|
|
135
|
+
mb: {
|
|
136
|
+
type: null,
|
|
137
|
+
required: false
|
|
138
|
+
},
|
|
139
|
+
ms: {
|
|
140
|
+
type: null,
|
|
141
|
+
required: false
|
|
142
|
+
},
|
|
143
|
+
me: {
|
|
144
|
+
type: null,
|
|
145
|
+
required: false
|
|
146
|
+
},
|
|
147
|
+
mis: {
|
|
148
|
+
type: null,
|
|
149
|
+
required: false
|
|
150
|
+
},
|
|
151
|
+
mie: {
|
|
152
|
+
type: null,
|
|
153
|
+
required: false
|
|
154
|
+
},
|
|
155
|
+
ml: {
|
|
156
|
+
type: null,
|
|
157
|
+
required: false
|
|
158
|
+
},
|
|
159
|
+
mr: {
|
|
160
|
+
type: null,
|
|
161
|
+
required: false
|
|
162
|
+
},
|
|
163
|
+
p: {
|
|
164
|
+
type: null,
|
|
165
|
+
required: false
|
|
166
|
+
},
|
|
167
|
+
py: {
|
|
168
|
+
type: null,
|
|
169
|
+
required: false
|
|
170
|
+
},
|
|
171
|
+
px: {
|
|
172
|
+
type: null,
|
|
173
|
+
required: false
|
|
174
|
+
},
|
|
175
|
+
pt: {
|
|
176
|
+
type: null,
|
|
177
|
+
required: false
|
|
178
|
+
},
|
|
179
|
+
pb: {
|
|
180
|
+
type: null,
|
|
181
|
+
required: false
|
|
182
|
+
},
|
|
183
|
+
ps: {
|
|
184
|
+
type: null,
|
|
185
|
+
required: false
|
|
186
|
+
},
|
|
187
|
+
pe: {
|
|
188
|
+
type: null,
|
|
189
|
+
required: false
|
|
190
|
+
},
|
|
191
|
+
pis: {
|
|
192
|
+
type: null,
|
|
193
|
+
required: false
|
|
194
|
+
},
|
|
195
|
+
pie: {
|
|
196
|
+
type: null,
|
|
197
|
+
required: false
|
|
198
|
+
},
|
|
199
|
+
pl: {
|
|
200
|
+
type: null,
|
|
201
|
+
required: false
|
|
202
|
+
},
|
|
203
|
+
pr: {
|
|
204
|
+
type: null,
|
|
205
|
+
required: false
|
|
206
|
+
},
|
|
207
|
+
bd: {
|
|
208
|
+
type: null,
|
|
209
|
+
required: false
|
|
210
|
+
},
|
|
211
|
+
bdrs: {
|
|
212
|
+
type: null,
|
|
213
|
+
required: false
|
|
214
|
+
},
|
|
215
|
+
bg: {
|
|
216
|
+
type: null,
|
|
217
|
+
required: false
|
|
218
|
+
},
|
|
219
|
+
c: {
|
|
220
|
+
type: null,
|
|
221
|
+
required: false
|
|
222
|
+
},
|
|
223
|
+
opacity: {
|
|
224
|
+
type: [
|
|
225
|
+
String,
|
|
226
|
+
Object,
|
|
227
|
+
Number
|
|
228
|
+
],
|
|
229
|
+
required: false
|
|
230
|
+
},
|
|
231
|
+
ff: {
|
|
232
|
+
type: [String, Object],
|
|
233
|
+
required: false
|
|
234
|
+
},
|
|
235
|
+
fz: {
|
|
236
|
+
type: null,
|
|
237
|
+
required: false
|
|
238
|
+
},
|
|
239
|
+
fw: {
|
|
240
|
+
type: null,
|
|
241
|
+
required: false
|
|
242
|
+
},
|
|
243
|
+
lts: {
|
|
244
|
+
type: null,
|
|
245
|
+
required: false
|
|
246
|
+
},
|
|
247
|
+
ta: {
|
|
248
|
+
type: [String, Object],
|
|
249
|
+
required: false
|
|
250
|
+
},
|
|
251
|
+
lh: {
|
|
252
|
+
type: null,
|
|
253
|
+
required: false
|
|
254
|
+
},
|
|
255
|
+
fs: {
|
|
256
|
+
type: null,
|
|
257
|
+
required: false
|
|
258
|
+
},
|
|
259
|
+
tt: {
|
|
260
|
+
type: [String, Object],
|
|
261
|
+
required: false
|
|
262
|
+
},
|
|
263
|
+
td: {
|
|
264
|
+
type: null,
|
|
265
|
+
required: false
|
|
266
|
+
},
|
|
267
|
+
w: {
|
|
268
|
+
type: null,
|
|
269
|
+
required: false
|
|
270
|
+
},
|
|
271
|
+
miw: {
|
|
272
|
+
type: null,
|
|
273
|
+
required: false
|
|
274
|
+
},
|
|
275
|
+
maw: {
|
|
276
|
+
type: null,
|
|
277
|
+
required: false
|
|
278
|
+
},
|
|
279
|
+
h: {
|
|
280
|
+
type: null,
|
|
281
|
+
required: false
|
|
282
|
+
},
|
|
283
|
+
mih: {
|
|
284
|
+
type: null,
|
|
285
|
+
required: false
|
|
286
|
+
},
|
|
287
|
+
mah: {
|
|
288
|
+
type: null,
|
|
289
|
+
required: false
|
|
290
|
+
},
|
|
291
|
+
bgsz: {
|
|
292
|
+
type: null,
|
|
293
|
+
required: false
|
|
294
|
+
},
|
|
295
|
+
bgp: {
|
|
296
|
+
type: null,
|
|
297
|
+
required: false
|
|
298
|
+
},
|
|
299
|
+
bgr: {
|
|
300
|
+
type: null,
|
|
301
|
+
required: false
|
|
302
|
+
},
|
|
303
|
+
bga: {
|
|
304
|
+
type: null,
|
|
305
|
+
required: false
|
|
306
|
+
},
|
|
307
|
+
pos: {
|
|
308
|
+
type: [String, Object],
|
|
309
|
+
required: false
|
|
310
|
+
},
|
|
311
|
+
top: {
|
|
312
|
+
type: null,
|
|
313
|
+
required: false
|
|
314
|
+
},
|
|
315
|
+
left: {
|
|
316
|
+
type: null,
|
|
317
|
+
required: false
|
|
318
|
+
},
|
|
319
|
+
bottom: {
|
|
320
|
+
type: null,
|
|
321
|
+
required: false
|
|
322
|
+
},
|
|
323
|
+
right: {
|
|
324
|
+
type: null,
|
|
325
|
+
required: false
|
|
326
|
+
},
|
|
327
|
+
inset: {
|
|
328
|
+
type: null,
|
|
329
|
+
required: false
|
|
330
|
+
},
|
|
331
|
+
display: {
|
|
332
|
+
type: null,
|
|
333
|
+
required: false
|
|
334
|
+
},
|
|
335
|
+
flex: {
|
|
336
|
+
type: null,
|
|
337
|
+
required: false
|
|
338
|
+
},
|
|
339
|
+
unstyled: {
|
|
340
|
+
type: Boolean,
|
|
341
|
+
required: false
|
|
342
|
+
},
|
|
343
|
+
variant: {
|
|
344
|
+
type: null,
|
|
345
|
+
required: false
|
|
346
|
+
},
|
|
347
|
+
classNames: {
|
|
348
|
+
type: null,
|
|
349
|
+
required: false
|
|
350
|
+
},
|
|
351
|
+
styles: {
|
|
352
|
+
type: null,
|
|
353
|
+
required: false
|
|
354
|
+
},
|
|
355
|
+
vars: {
|
|
356
|
+
type: Function,
|
|
357
|
+
required: false
|
|
358
|
+
},
|
|
359
|
+
attributes: {
|
|
360
|
+
type: null,
|
|
361
|
+
required: false
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
setup(__props, { expose: __expose }) {
|
|
365
|
+
const rootRef = (0, vue.ref)(null);
|
|
366
|
+
const attrs = (0, vue.useAttrs)();
|
|
367
|
+
const slots = (0, vue.useSlots)();
|
|
368
|
+
const rawProps = __props;
|
|
369
|
+
const defaultProps = {
|
|
370
|
+
orientation: "horizontal",
|
|
371
|
+
lineSize: 2,
|
|
372
|
+
withHandle: true,
|
|
373
|
+
resetOnDoubleClick: true
|
|
374
|
+
};
|
|
375
|
+
const props = require_use_component_props.useComponentProps({
|
|
376
|
+
component: "CSplitter",
|
|
377
|
+
defaultProps,
|
|
378
|
+
props: rawProps
|
|
379
|
+
});
|
|
380
|
+
const knownProps = [
|
|
381
|
+
"classNames",
|
|
382
|
+
"className",
|
|
383
|
+
"style",
|
|
384
|
+
"styles",
|
|
385
|
+
"unstyled",
|
|
386
|
+
"vars",
|
|
387
|
+
"orientation",
|
|
388
|
+
"sizes",
|
|
389
|
+
"onSizeChange",
|
|
390
|
+
"onResizeStart",
|
|
391
|
+
"onResizeEnd",
|
|
392
|
+
"onCollapseChange",
|
|
393
|
+
"redistribute",
|
|
394
|
+
"step",
|
|
395
|
+
"shiftStep",
|
|
396
|
+
"lineSize",
|
|
397
|
+
"handleColor",
|
|
398
|
+
"handleIcon",
|
|
399
|
+
"withHandle",
|
|
400
|
+
"resetOnDoubleClick",
|
|
401
|
+
"mod",
|
|
402
|
+
"attributes"
|
|
403
|
+
];
|
|
404
|
+
const modList = (0, vue.computed)(() => [{ orientation: props.value.orientation }]);
|
|
405
|
+
const getStyles = require_use_styles.useStyles({
|
|
406
|
+
name: "Splitter",
|
|
407
|
+
classes: require_splitter_module.default,
|
|
408
|
+
props: {
|
|
409
|
+
...props.value,
|
|
410
|
+
...attrs
|
|
411
|
+
},
|
|
412
|
+
className: props.value.className,
|
|
413
|
+
style: props.value.style,
|
|
414
|
+
classNames: props.value.classNames,
|
|
415
|
+
styles: props.value.styles,
|
|
416
|
+
unstyled: props.value.unstyled,
|
|
417
|
+
attributes: props.value.attributes,
|
|
418
|
+
vars: props.value.vars,
|
|
419
|
+
varsResolver: require_splitter_utils.varsResolver
|
|
420
|
+
});
|
|
421
|
+
const paneVNodes = (0, vue.ref)([]);
|
|
422
|
+
const panels = (0, vue.ref)([]);
|
|
423
|
+
(0, vue.watchEffect)(() => {
|
|
424
|
+
const filtered = (slots.default?.() || []).filter((vnode) => vnode.type === require_splitter_pane.default);
|
|
425
|
+
paneVNodes.value = filtered;
|
|
426
|
+
panels.value = filtered.map((vnode) => {
|
|
427
|
+
const vProps = vnode.props || {};
|
|
428
|
+
return {
|
|
429
|
+
defaultSize: vProps.defaultSize ?? vProps["default-size"] ?? 0,
|
|
430
|
+
min: vProps.min ?? void 0,
|
|
431
|
+
max: vProps.max ?? void 0,
|
|
432
|
+
collapsible: vProps.collapsible ?? false,
|
|
433
|
+
collapseThreshold: vProps.collapseThreshold ?? vProps["collapse-threshold"] ?? void 0
|
|
434
|
+
};
|
|
435
|
+
});
|
|
436
|
+
});
|
|
437
|
+
const splitter = (0, _cck_ui_hooks.useSplitter)({
|
|
438
|
+
panels: panels.value,
|
|
439
|
+
orientation: props.value.orientation,
|
|
440
|
+
sizes: props.value.sizes,
|
|
441
|
+
onSizeChange: props.value.onSizeChange,
|
|
442
|
+
onResizeStart: props.value.onResizeStart,
|
|
443
|
+
onResizeEnd: props.value.onResizeEnd,
|
|
444
|
+
onCollapseChange: props.value.onCollapseChange,
|
|
445
|
+
redistribute: props.value.redistribute,
|
|
446
|
+
step: props.value.step,
|
|
447
|
+
shiftStep: props.value.shiftStep,
|
|
448
|
+
resetOnDoubleClick: props.value.resetOnDoubleClick
|
|
449
|
+
});
|
|
450
|
+
(0, vue.watch)(rootRef, (newVal) => {
|
|
451
|
+
if (newVal) {
|
|
452
|
+
const domEl = newVal.$el || newVal.root;
|
|
453
|
+
if (domEl instanceof HTMLElement) splitter.containerRef(domEl);
|
|
454
|
+
} else splitter.containerRef(null);
|
|
455
|
+
}, { immediate: true });
|
|
456
|
+
const getHandleAttrs = (index) => {
|
|
457
|
+
const handleProps = splitter.getHandleProps({ index });
|
|
458
|
+
const { ref: _ref, onDoubleClick, ...attrs } = handleProps;
|
|
459
|
+
return {
|
|
460
|
+
role: attrs.role,
|
|
461
|
+
"aria-orientation": attrs["aria-orientation"],
|
|
462
|
+
"aria-valuenow": handleProps["aria-valuenow"],
|
|
463
|
+
"aria-valuemin": handleProps["aria-valuemin"],
|
|
464
|
+
"aria-valuemax": handleProps["aria-valuemax"],
|
|
465
|
+
tabIndex: handleProps.tabIndex,
|
|
466
|
+
"data-active": handleProps["data-active"],
|
|
467
|
+
"data-orientation": handleProps["data-orientation"]
|
|
468
|
+
};
|
|
469
|
+
};
|
|
470
|
+
const isHandleActive = (index) => {
|
|
471
|
+
return splitter.activeHandle === index;
|
|
472
|
+
};
|
|
473
|
+
const handleAttrs = (index) => {
|
|
474
|
+
const styles = getStyles("handle");
|
|
475
|
+
const attrs = getHandleAttrs(index);
|
|
476
|
+
return {
|
|
477
|
+
...styles,
|
|
478
|
+
...attrs,
|
|
479
|
+
key: `handle-${index}`
|
|
480
|
+
};
|
|
481
|
+
};
|
|
482
|
+
const getPaneStyle = (index) => {
|
|
483
|
+
const size = splitter.sizes.value[index];
|
|
484
|
+
if (!splitter.pixelMode) return { flexBasis: `${typeof size === "number" ? size : parseFloat(size)}%` };
|
|
485
|
+
if (typeof size === "string" && (size.endsWith("px") || size.endsWith("rem"))) return {
|
|
486
|
+
flexGrow: 0,
|
|
487
|
+
flexShrink: 1,
|
|
488
|
+
flexBasis: size
|
|
489
|
+
};
|
|
490
|
+
return {
|
|
491
|
+
flexGrow: typeof size === "number" ? size : parseFloat(size),
|
|
492
|
+
flexShrink: 1,
|
|
493
|
+
flexBasis: 0
|
|
494
|
+
};
|
|
495
|
+
};
|
|
496
|
+
(0, vue.watch)(() => props.value.sizes, (newSizes) => {
|
|
497
|
+
if (!newSizes) return;
|
|
498
|
+
const currentSizes = splitter.sizes.value;
|
|
499
|
+
if (JSON.stringify(newSizes) !== JSON.stringify(currentSizes)) splitter.setSizes(newSizes);
|
|
500
|
+
}, {
|
|
501
|
+
immediate: true,
|
|
502
|
+
deep: true
|
|
503
|
+
});
|
|
504
|
+
const collapsed = (0, vue.computed)(() => splitter.collapsed);
|
|
505
|
+
const orientation = (0, vue.computed)(() => props.value.orientation || "horizontal");
|
|
506
|
+
require_splitter_context.provideSplitterContext({
|
|
507
|
+
getStyles,
|
|
508
|
+
sizes: splitter.sizes,
|
|
509
|
+
collapsed,
|
|
510
|
+
orientation,
|
|
511
|
+
getPaneStyle
|
|
512
|
+
});
|
|
513
|
+
const defaultIcon = (0, vue.computed)(() => props.value.orientation === "vertical" ? "horizontal" : "vertical");
|
|
514
|
+
const thumbIcon = (0, vue.computed)(() => {
|
|
515
|
+
if (props.value.handleIcon !== void 0) return props.value.handleIcon;
|
|
516
|
+
return require_grip_icon.default;
|
|
517
|
+
});
|
|
518
|
+
const withHandle = (0, vue.computed)(() => props.value.withHandle);
|
|
519
|
+
const handleDblClick = (index) => {
|
|
520
|
+
if (props.value.resetOnDoubleClick !== false) splitter.reset(index);
|
|
521
|
+
};
|
|
522
|
+
const rootAttrs = (0, vue.computed)(() => getStyles("root"));
|
|
523
|
+
const mergedAttrs = (0, vue.computed)(() => {
|
|
524
|
+
const others = {};
|
|
525
|
+
const propsValue = props.value;
|
|
526
|
+
for (const key in propsValue) if (!knownProps.includes(key)) others[key] = propsValue[key];
|
|
527
|
+
const userMod = props.value.mod;
|
|
528
|
+
const mergedMod = [...Array.isArray(userMod) ? userMod : [userMod].filter(Boolean), ...modList.value || []];
|
|
529
|
+
return {
|
|
530
|
+
...others,
|
|
531
|
+
mod: mergedMod,
|
|
532
|
+
...rootAttrs.value
|
|
533
|
+
};
|
|
534
|
+
});
|
|
535
|
+
__expose({
|
|
536
|
+
root: (0, vue.computed)(() => rootRef.value?.root || null),
|
|
537
|
+
sizes: splitter.sizes,
|
|
538
|
+
collapsed: splitter.collapsed,
|
|
539
|
+
activeHandle: splitter.activeHandle,
|
|
540
|
+
setSizes: splitter.setSizes,
|
|
541
|
+
collapse: splitter.collapse,
|
|
542
|
+
expand: splitter.expand,
|
|
543
|
+
toggleCollapse: splitter.toggleCollapse,
|
|
544
|
+
reset: splitter.reset
|
|
545
|
+
});
|
|
546
|
+
const __returned__ = {
|
|
547
|
+
rootRef,
|
|
548
|
+
attrs,
|
|
549
|
+
slots,
|
|
550
|
+
rawProps,
|
|
551
|
+
defaultProps,
|
|
552
|
+
props,
|
|
553
|
+
knownProps,
|
|
554
|
+
modList,
|
|
555
|
+
getStyles,
|
|
556
|
+
paneVNodes,
|
|
557
|
+
panels,
|
|
558
|
+
splitter,
|
|
559
|
+
getHandleAttrs,
|
|
560
|
+
isHandleActive,
|
|
561
|
+
handleAttrs,
|
|
562
|
+
getPaneStyle,
|
|
563
|
+
collapsed,
|
|
564
|
+
orientation,
|
|
565
|
+
defaultIcon,
|
|
566
|
+
thumbIcon,
|
|
567
|
+
withHandle,
|
|
568
|
+
handleDblClick,
|
|
569
|
+
rootAttrs,
|
|
570
|
+
mergedAttrs,
|
|
571
|
+
get CBox() {
|
|
572
|
+
return require_index.CBox;
|
|
573
|
+
}
|
|
574
|
+
};
|
|
575
|
+
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
576
|
+
enumerable: false,
|
|
577
|
+
value: true
|
|
578
|
+
});
|
|
579
|
+
return __returned__;
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
583
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)($setup["CBox"], (0, vue.mergeProps)({ ref: "rootRef" }, $setup.mergedAttrs), {
|
|
584
|
+
default: (0, vue.withCtx)(() => [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)($setup.paneVNodes, (vnode, index) => {
|
|
585
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: `pane-${index}` }, [index > 0 ? ((0, vue.openBlock)(), (0, vue.createBlock)($setup["CBox"], (0, vue.mergeProps)({
|
|
586
|
+
key: 0,
|
|
587
|
+
ref_for: true
|
|
588
|
+
}, $setup.handleAttrs(index - 1), {
|
|
589
|
+
key: `handle-${index - 1}`,
|
|
590
|
+
onPointerdown: $setup.splitter.getHandleEventHandlers({ index: index - 1 }).onPointerDown,
|
|
591
|
+
onTouchstart: $setup.splitter.getHandleEventHandlers({ index: index - 1 }).onTouchStart,
|
|
592
|
+
onKeydown: $setup.splitter.getHandleEventHandlers({ index: index - 1 }).onKeyDown,
|
|
593
|
+
onDblclick: ($event) => $setup.handleDblClick(index - 1)
|
|
594
|
+
}), {
|
|
595
|
+
default: (0, vue.withCtx)(() => [$setup.withHandle ? ((0, vue.openBlock)(), (0, vue.createBlock)($setup["CBox"], (0, vue.mergeProps)({
|
|
596
|
+
key: 0,
|
|
597
|
+
ref_for: true
|
|
598
|
+
}, $setup.getStyles("thumb"), {
|
|
599
|
+
"data-orientation": $setup.orientation,
|
|
600
|
+
"data-active": $setup.isHandleActive(index - 1) || void 0
|
|
601
|
+
}), {
|
|
602
|
+
default: (0, vue.withCtx)(() => [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)($setup.thumbIcon), { orientation: $setup.defaultIcon }, null, 8, ["orientation"]))]),
|
|
603
|
+
_: 1
|
|
604
|
+
}, 16, ["data-orientation", "data-active"])) : (0, vue.createCommentVNode)("v-if", true)]),
|
|
605
|
+
_: 2
|
|
606
|
+
}, 1040, [
|
|
607
|
+
"onPointerdown",
|
|
608
|
+
"onTouchstart",
|
|
609
|
+
"onKeydown",
|
|
610
|
+
"onDblclick"
|
|
611
|
+
])) : (0, vue.createCommentVNode)("v-if", true), ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(vnode), { __index: index }, null, 8, ["__index"]))], 64);
|
|
612
|
+
}), 128))]),
|
|
613
|
+
_: 1
|
|
614
|
+
}, 16);
|
|
615
|
+
}
|
|
616
|
+
var splitter_default = /*#__PURE__*/ require_export_helper.default(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/cck-ui/cck-ui/packages/@cck-ui/core/src/components/splitter/splitter.vue"]]);
|
|
617
|
+
//#endregion
|
|
618
|
+
exports.default = splitter_default;
|
|
619
|
+
|
|
620
|
+
//# sourceMappingURL=splitter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splitter.cjs","names":[],"sources":["../../../src/components/splitter/splitter.vue"],"sourcesContent":["<template>\n <c-box ref=\"rootRef\" v-bind=\"mergedAttrs\">\n <template v-for=\"(vnode, index) in paneVNodes\" :key=\"`pane-${index}`\">\n <c-box\n v-if=\"index > 0\"\n v-bind=\"handleAttrs(index - 1)\"\n :key=\"`handle-${index - 1}`\"\n @pointerdown=\"splitter.getHandleEventHandlers({ index: index - 1 }).onPointerDown\"\n @touchstart=\"splitter.getHandleEventHandlers({ index: index - 1 }).onTouchStart\"\n @keydown=\"splitter.getHandleEventHandlers({ index: index - 1 }).onKeyDown\"\n @dblclick=\"handleDblClick(index - 1)\"\n >\n <c-box\n v-if=\"withHandle\"\n v-bind=\"getStyles('thumb')\"\n :data-orientation=\"orientation\"\n :data-active=\"isHandleActive(index - 1) || undefined\"\n >\n <component :is=\"thumbIcon\" :orientation=\"defaultIcon\" />\n </c-box>\n </c-box>\n\n <component :is=\"vnode\" :__index=\"index\" />\n </template>\n </c-box>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref, useAttrs, useSlots, watch, watchEffect } from 'vue'\nimport { CBox, useComponentProps, useStyles } from '../../core'\nimport { SplitterFactory, type SplitterProps } from './splitter.types'\nimport classes from './splitter.module.css'\nimport { varsResolver } from './splitter.utils'\nimport SplitterPane from './splitter-pane/splitter-pane.vue'\nimport { useSplitter, UseSplitterPanel } from '@cck-ui/hooks'\nimport { provideSplitterContext } from './splitter.context'\nimport GripIcon from './grip-icon.vue'\n\ndefineOptions({\n name: 'CSplitter',\n})\n\nconst rootRef = ref<InstanceType<typeof CBox> | null>(null)\n\nconst attrs = useAttrs()\nconst slots = useSlots()\n\nconst rawProps = defineProps<SplitterProps>()\n\nconst defaultProps = {\n orientation: 'horizontal',\n lineSize: 2,\n withHandle: true,\n resetOnDoubleClick: true,\n} satisfies Partial<SplitterProps>\n\nconst props = useComponentProps({\n component: 'CSplitter',\n defaultProps,\n props: rawProps,\n})\n\nconst knownProps = [\n 'classNames',\n 'className',\n 'style',\n 'styles',\n 'unstyled',\n 'vars',\n 'orientation',\n 'sizes',\n 'onSizeChange',\n 'onResizeStart',\n 'onResizeEnd',\n 'onCollapseChange',\n 'redistribute',\n 'step',\n 'shiftStep',\n 'lineSize',\n 'handleColor',\n 'handleIcon',\n 'withHandle',\n 'resetOnDoubleClick',\n 'mod',\n 'attributes',\n]\n\nconst modList = computed(() => [\n {\n orientation: props.value.orientation,\n },\n])\n\nconst getStyles = useStyles<SplitterFactory>({\n name: 'Splitter',\n classes,\n props: { ...props.value, ...attrs } as SplitterProps,\n className: props.value.className,\n style: props.value.style,\n classNames: props.value.classNames,\n styles: props.value.styles,\n unstyled: props.value.unstyled,\n attributes: props.value.attributes,\n vars: props.value.vars,\n varsResolver,\n})\n\nconst paneVNodes = ref<any[]>([])\nconst panels = ref<UseSplitterPanel[]>([])\n\nwatchEffect(() => {\n const defaultSlots = slots.default?.() || []\n const filtered = defaultSlots.filter((vnode) => vnode.type === SplitterPane)\n paneVNodes.value = filtered\n panels.value = filtered.map((vnode) => {\n const vProps = vnode.props || {}\n return {\n defaultSize: vProps.defaultSize ?? vProps['default-size'] ?? 0,\n min: vProps.min ?? undefined,\n max: vProps.max ?? undefined,\n collapsible: vProps.collapsible ?? false,\n collapseThreshold: vProps.collapseThreshold ?? vProps['collapse-threshold'] ?? undefined,\n }\n })\n})\n\nconst splitter = useSplitter({\n panels: panels.value,\n orientation: props.value.orientation,\n sizes: props.value.sizes,\n onSizeChange: props.value.onSizeChange,\n onResizeStart: props.value.onResizeStart,\n onResizeEnd: props.value.onResizeEnd,\n onCollapseChange: props.value.onCollapseChange,\n redistribute: props.value.redistribute,\n step: props.value.step,\n shiftStep: props.value.shiftStep,\n resetOnDoubleClick: props.value.resetOnDoubleClick,\n})\n\nwatch(\n rootRef,\n (newVal) => {\n if (newVal) {\n const domEl = newVal.$el || newVal.root\n if (domEl instanceof HTMLElement) {\n splitter.containerRef(domEl)\n }\n } else {\n splitter.containerRef(null)\n }\n },\n { immediate: true }\n)\n\nconst getHandleAttrs = (index: number) => {\n const handleProps = splitter.getHandleProps({ index })\n const { ref: _ref, onDoubleClick, ...attrs } = handleProps\n return {\n role: attrs.role,\n 'aria-orientation': attrs['aria-orientation'],\n 'aria-valuenow': handleProps['aria-valuenow'],\n 'aria-valuemin': handleProps['aria-valuemin'],\n 'aria-valuemax': handleProps['aria-valuemax'],\n tabIndex: handleProps.tabIndex,\n 'data-active': handleProps['data-active'],\n 'data-orientation': handleProps['data-orientation'],\n }\n}\n\nconst isHandleActive = (index: number) => {\n return splitter.activeHandle === index\n}\n\nconst handleAttrs = (index: number) => {\n const styles = getStyles('handle')\n const attrs = getHandleAttrs(index)\n return {\n ...styles,\n ...attrs,\n key: `handle-${index}`,\n }\n}\n\nconst getPaneStyle = (index: number) => {\n const sizes = splitter.sizes.value\n const size = sizes[index]\n const pixelMode = splitter.pixelMode\n if (!pixelMode) {\n const magnitude = typeof size === 'number' ? size : parseFloat(size as string)\n return { flexBasis: `${magnitude}%` }\n }\n const isFixed = typeof size === 'string' && (size.endsWith('px') || size.endsWith('rem'))\n if (isFixed) {\n return { flexGrow: 0, flexShrink: 1, flexBasis: size as string }\n }\n const magnitude = typeof size === 'number' ? size : parseFloat(size as string)\n return { flexGrow: magnitude, flexShrink: 1, flexBasis: 0 }\n}\n\nwatch(\n () => props.value.sizes,\n (newSizes) => {\n if (!newSizes) {\n return\n }\n const currentSizes = splitter.sizes.value\n if (JSON.stringify(newSizes) !== JSON.stringify(currentSizes)) {\n splitter.setSizes(newSizes)\n }\n },\n { immediate: true, deep: true }\n)\n\nconst collapsed = computed(() => splitter.collapsed)\nconst orientation = computed(() => props.value.orientation || 'horizontal')\n\nprovideSplitterContext({\n getStyles,\n sizes: splitter.sizes,\n collapsed,\n orientation,\n getPaneStyle,\n})\n\nconst defaultIcon = computed(() =>\n props.value.orientation === 'vertical' ? 'horizontal' : 'vertical'\n)\n\nconst thumbIcon = computed(() => {\n if (props.value.handleIcon !== undefined) {\n return props.value.handleIcon\n }\n return GripIcon\n})\n\nconst withHandle = computed(() => props.value.withHandle)\n\nconst handleDblClick = (index: number) => {\n if (props.value.resetOnDoubleClick !== false) {\n splitter.reset(index)\n }\n}\n\nconst rootAttrs = computed(() => getStyles('root'))\n\nconst mergedAttrs = computed(() => {\n const others: Record<string, any> = {}\n const propsValue = props.value\n for (const key in propsValue) {\n if (!knownProps.includes(key)) {\n others[key] = propsValue[key as keyof typeof propsValue]\n }\n }\n const userMod = props.value.mod\n const mergedMod = [\n ...(Array.isArray(userMod) ? userMod : [userMod].filter(Boolean)),\n ...(modList.value || []),\n ]\n return { ...others, mod: mergedMod, ...rootAttrs.value }\n})\n\ndefineExpose({\n root: computed(() => rootRef.value?.root || null),\n sizes: splitter.sizes,\n collapsed: splitter.collapsed,\n activeHandle: splitter.activeHandle,\n setSizes: splitter.setSizes,\n collapse: splitter.collapse,\n expand: splitter.expand,\n toggleCollapse: splitter.toggleCollapse,\n reset: splitter.reset,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CA,MAAM,WAAA,GAAA,IAAA,IAAA,CAAgD,IAAI;EAE1D,MAAM,SAAA,GAAA,IAAA,SAAA,CAAiB;EACvB,MAAM,SAAA,GAAA,IAAA,SAAA,CAAiB;EAEvB,MAAM,WAAW;EAEjB,MAAM,eAAe;GACnB,aAAa;GACb,UAAU;GACV,YAAY;GACZ,oBAAoB;EACtB;EAEA,MAAM,QAAQ,4BAAA,kBAAkB;GAC9B,WAAW;GACX;GACA,OAAO;EACT,CAAC;EAED,MAAM,aAAa;GACjB;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;G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A,GAAA,IAAA,UAAA,CAAA,IAAA,GAAA,IAAA,YAAA,EAAA,GAAA,IAAA,wBAAA,CAAxC,OAAA,SAAS,GAAA,EAAG,aAAa,OAAA,YAAW,GAAA,MAAA,GAAA,CAAA,aAAA,CAAA,EAAA,CAAA;;;;;;;;;iIAIxC,KAAK,GAAA,EAAG,SAAS,MAAK,GAAA,MAAA,GAAA,CAAA,SAAA,CAAA,EAAA,GAAA,EAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
let vue = require("vue");
|
|
3
|
+
//#region packages/@cck-ui/core/src/components/splitter/splitter.context.ts
|
|
4
|
+
const SPLITTER_CONTEXT_KEY = Symbol("SplitterContext");
|
|
5
|
+
function provideSplitterContext(value) {
|
|
6
|
+
(0, vue.provide)(SPLITTER_CONTEXT_KEY, value);
|
|
7
|
+
}
|
|
8
|
+
function useSplitterContext() {
|
|
9
|
+
const ctx = (0, vue.inject)(SPLITTER_CONTEXT_KEY);
|
|
10
|
+
if (!ctx) throw new Error("Splitter component was not found in the tree");
|
|
11
|
+
return ctx;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.provideSplitterContext = provideSplitterContext;
|
|
15
|
+
exports.useSplitterContext = useSplitterContext;
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=splitter.context.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splitter.context.cjs","names":[],"sources":["../../../src/components/splitter/splitter.context.ts"],"sourcesContent":["import type { SplitterPaneSize } from '@cck-ui/hooks'\nimport type { GetStylesApi } from '../../core'\nimport type { SplitterFactory } from './splitter.types'\nimport { ComputedRef, inject, InjectionKey, provide } from 'vue'\n\nexport interface SplitterContextValue {\n getStyles: GetStylesApi<SplitterFactory>\n sizes: ComputedRef<SplitterPaneSize[]>\n collapsed: ComputedRef<boolean[]>\n orientation: ComputedRef<'horizontal' | 'vertical'>\n getPaneStyle: (index: number) => Record<string, any>\n}\n\nconst SPLITTER_CONTEXT_KEY: InjectionKey<SplitterContextValue> = Symbol('SplitterContext')\n\nexport function provideSplitterContext(value: SplitterContextValue) {\n provide(SPLITTER_CONTEXT_KEY, value)\n}\n\nexport function useSplitterContext() {\n const ctx = inject(SPLITTER_CONTEXT_KEY)\n if (!ctx) {\n throw new Error('Splitter component was not found in the tree')\n }\n return ctx\n}\n"],"mappings":";;;AAaA,MAAM,uBAA2D,OAAO,iBAAiB;AAEzF,SAAgB,uBAAuB,OAA6B;CAClE,CAAA,GAAA,IAAA,QAAA,CAAQ,sBAAsB,KAAK;AACrC;AAEA,SAAgB,qBAAqB;CACnC,MAAM,OAAA,GAAA,IAAA,OAAA,CAAa,oBAAoB;CACvC,IAAI,CAAC,KACH,MAAM,IAAI,MAAM,8CAA8C;CAEhE,OAAO;AACT"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region packages/@cck-ui/core/src/components/splitter/splitter.module.css
|
|
3
|
+
var splitter_module_default = {
|
|
4
|
+
"root": "m_ea473028",
|
|
5
|
+
"pane": "m_ea4612ae",
|
|
6
|
+
"handle": "m_636563ee",
|
|
7
|
+
"thumb": "m_5eb7eb50"
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.default = splitter_module_default;
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=splitter.module.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splitter.module.cjs","names":[],"sources":["../../../src/components/splitter/splitter.module.css"],"sourcesContent":[".root {\n display: flex;\n\n &:where([data-orientation='horizontal']) {\n flex-direction: row;\n }\n\n &:where([data-orientation='vertical']) {\n flex-direction: column;\n }\n}\n\n.pane {\n flex-grow: 0;\n flex-shrink: 1;\n overflow: auto;\n}\n\n.handle {\n flex: 0 0 var(--splitter-line-size, rem(2px));\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n touch-action: none;\n outline: none;\n background-color: var(--splitter-handle-color, var(--c-color-body));\n\n &:where([data-orientation='horizontal']) {\n cursor: col-resize;\n }\n\n &:where([data-orientation='vertical']) {\n cursor: row-resize;\n }\n}\n\n.thumb {\n position: absolute;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 1000px;\n color: var(--c-color-dimmed);\n transition: color 100ms ease;\n\n @mixin where-light {\n background-color: var(--c-color-white);\n border: rem(1px) solid var(--c-color-gray-3);\n }\n\n @mixin where-dark {\n background-color: var(--c-color-dark-6);\n border: rem(1px) solid var(--c-color-dark-4);\n }\n\n &:where([data-orientation='horizontal']) {\n width: rem(12px);\n height: rem(60px);\n }\n\n &:where([data-orientation='vertical']) {\n width: rem(60px);\n height: rem(12px);\n }\n\n & > svg {\n width: 100%;\n height: 100%;\n }\n\n .handle:focus-visible & {\n box-shadow: 0 0 0 rem(2px) var(--c-primary-color-filled);\n }\n}\n"],"mappings":";;AAAA,IAAA,0BAAe;CAAC,QAAO;CAAa,QAAO;CAAa,UAAS;CAAa,SAAQ;AAAY"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_rem = require("../../core/utils/units-converters/rem.cjs");
|
|
3
|
+
const require_get_theme_color = require("../../core/config-provider/color-functions/get-theme-color/get-theme-color.cjs");
|
|
4
|
+
//#region packages/@cck-ui/core/src/components/splitter/splitter.utils.ts
|
|
5
|
+
const varsResolver = require("../../core/styles-api/create-vars-resolver/create-vars-resolver.cjs").createVarsResolver((theme, { lineSize, handleColor }) => ({ root: {
|
|
6
|
+
"--splitter-line-size": require_rem.rem(lineSize),
|
|
7
|
+
"--splitter-handle-color": handleColor ? require_get_theme_color.getThemeColor(handleColor, theme) : void 0
|
|
8
|
+
} }));
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.varsResolver = varsResolver;
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=splitter.utils.cjs.map
|