@dragcraft/designer 0.0.1

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.
@@ -0,0 +1,613 @@
1
+ .dc-designer, .dc-designer__body, .dc-designer__panel, .dc-left-sidebar, .dc-right-sidebar, .dc-left-sidebar__surface, .dc-right-sidebar__surface, .dc-left-sidebar__rail, .dc-right-sidebar__rail, .dc-sidebar-rail__extension, .dc-left-sidebar__tab, .dc-right-sidebar__tab, .dc-left-sidebar__content, .dc-right-sidebar__content, .dc-sidebar-toggle, .dc-workspace-backdrop, .dc-material-panel, .dc-material-panel__header, .dc-material-panel__search, .dc-material-panel__search-input, .dc-material-panel__search-clear, .dc-material-panel__groups, .dc-material-group__header, .dc-material-group__body, .dc-material-item, .dc-material-item__icon, .dc-material-item__thumbnail, .dc-material-item__content, .dc-material-item__title, .dc-structure-panel, .dc-structure-panel__header, .dc-structure-panel__list, .dc-structure-panel__item, .dc-structure-panel__select, .dc-structure-panel__main, .dc-structure-panel__actions, .dc-structure-panel__action, .dc-structure-panel__region, .dc-structure-panel__empty, .dc-property-panel, .dc-property-panel__content, .dc-property-panel__empty, .dc-canvas, .dc-canvas-controls, .dc-canvas-controls__history, .dc-canvas-controls__button, .dc-canvas__viewport, .dc-canvas__stage, .dc-canvas__content, .dc-canvas__interaction-layer {
2
+ box-sizing: border-box;
3
+ }
4
+
5
+ .dc-designer__panel--left, .dc-designer__panel--right, .dc-left-sidebar__rail, .dc-right-sidebar__rail, .dc-left-sidebar__tab, .dc-right-sidebar__tab, .dc-material-panel__search-input, .dc-material-item, .dc-structure-panel__item, .dc-canvas-controls__history, .dc-canvas-controls__button {
6
+ border: 1px solid #0000;
7
+ }
8
+
9
+ .dc-sidebar-rail__extension {
10
+ border-top: 1px solid #0000;
11
+ }
12
+
13
+ .dc-designer {
14
+ isolation: isolate;
15
+ flex: auto;
16
+ width: 100%;
17
+ min-width: 0;
18
+ height: 100%;
19
+ min-height: 0;
20
+ display: block;
21
+ position: relative;
22
+ overflow: hidden;
23
+ }
24
+
25
+ .dc-designer__body {
26
+ min-width: 0;
27
+ height: 100%;
28
+ min-height: 0;
29
+ display: grid;
30
+ position: relative;
31
+ overflow: hidden;
32
+ }
33
+
34
+ .dc-designer--wide .dc-designer__body {
35
+ grid-template-columns: var(--_dc-workspace-left-width)
36
+ minmax(0, 1fr)
37
+ var(--_dc-workspace-right-width);
38
+ }
39
+
40
+ .dc-designer--wide:not(.dc-designer--left-open) .dc-designer__body {
41
+ grid-template-columns: var(--_dc-workspace-rail-width)
42
+ minmax(0, 1fr)
43
+ var(--_dc-workspace-right-width);
44
+ }
45
+
46
+ .dc-designer--wide:not(.dc-designer--right-open) .dc-designer__body {
47
+ grid-template-columns: var(--_dc-workspace-left-width)
48
+ minmax(0, 1fr)
49
+ var(--_dc-workspace-rail-width);
50
+ }
51
+
52
+ .dc-designer--wide:not(.dc-designer--left-open):not(.dc-designer--right-open) .dc-designer__body {
53
+ grid-template-columns: var(--_dc-workspace-rail-width)
54
+ minmax(0, 1fr)
55
+ var(--_dc-workspace-rail-width);
56
+ }
57
+
58
+ .dc-designer__panel {
59
+ min-width: 0;
60
+ min-height: 0;
61
+ overflow: hidden;
62
+ }
63
+
64
+ .dc-designer__panel--left, .dc-designer__panel--right {
65
+ z-index: 800;
66
+ position: relative;
67
+ overflow: visible;
68
+ }
69
+
70
+ .dc-designer__panel--left {
71
+ border-width: 0 1px 0 0;
72
+ }
73
+
74
+ .dc-designer__panel--right {
75
+ border-width: 0 0 0 1px;
76
+ }
77
+
78
+ .dc-designer__panel--center {
79
+ z-index: 1;
80
+ position: relative;
81
+ }
82
+
83
+ .dc-left-sidebar, .dc-right-sidebar {
84
+ width: 100%;
85
+ min-width: 0;
86
+ height: 100%;
87
+ position: relative;
88
+ }
89
+
90
+ .dc-left-sidebar__surface, .dc-right-sidebar__surface {
91
+ width: 100%;
92
+ min-width: 0;
93
+ height: 100%;
94
+ display: grid;
95
+ overflow: hidden;
96
+ }
97
+
98
+ .dc-left-sidebar__surface {
99
+ grid-template-columns: var(--_dc-workspace-rail-width) minmax(0, 1fr);
100
+ }
101
+
102
+ .dc-right-sidebar__surface {
103
+ grid-template-columns: minmax(0, 1fr) var(--_dc-workspace-rail-width);
104
+ }
105
+
106
+ .dc-left-sidebar__rail, .dc-right-sidebar__rail {
107
+ width: var(--_dc-workspace-rail-width);
108
+ flex-direction: column;
109
+ align-items: center;
110
+ gap: 4px;
111
+ padding: 8px 6px;
112
+ display: flex;
113
+ }
114
+
115
+ .dc-left-sidebar__rail {
116
+ border-width: 0 1px 0 0;
117
+ }
118
+
119
+ .dc-right-sidebar__rail {
120
+ border-width: 0 0 0 1px;
121
+ grid-area: 1 / 2;
122
+ }
123
+
124
+ .dc-sidebar-rail__extension {
125
+ flex-direction: column;
126
+ align-items: center;
127
+ gap: 4px;
128
+ width: 100%;
129
+ margin-top: 4px;
130
+ padding-top: 8px;
131
+ display: flex;
132
+ }
133
+
134
+ .dc-left-sidebar__tab, .dc-right-sidebar__tab {
135
+ width: var(--dc-control-height-sm, 28px);
136
+ height: var(--dc-control-height-sm, 28px);
137
+ cursor: pointer;
138
+ justify-content: center;
139
+ align-items: center;
140
+ padding: 0;
141
+ display: inline-flex;
142
+ }
143
+
144
+ .dc-right-sidebar__tab:disabled {
145
+ cursor: not-allowed;
146
+ }
147
+
148
+ .dc-left-sidebar__content, .dc-right-sidebar__content {
149
+ min-width: 0;
150
+ height: 100%;
151
+ overflow: hidden;
152
+ }
153
+
154
+ .dc-right-sidebar__content {
155
+ grid-area: 1 / 1;
156
+ }
157
+
158
+ .dc-designer--wide:not(.dc-designer--left-open) .dc-left-sidebar__surface {
159
+ grid-template-columns: var(--_dc-workspace-rail-width) 0;
160
+ }
161
+
162
+ .dc-designer--wide:not(.dc-designer--left-open) .dc-left-sidebar__content, .dc-designer--wide:not(.dc-designer--right-open) .dc-right-sidebar__content {
163
+ visibility: hidden;
164
+ }
165
+
166
+ .dc-designer--wide:not(.dc-designer--right-open) .dc-right-sidebar__surface {
167
+ grid-template-columns: 0 var(--_dc-workspace-rail-width);
168
+ }
169
+
170
+ .dc-sidebar-toggle {
171
+ z-index: 6;
172
+ cursor: pointer;
173
+ border: 0;
174
+ justify-content: center;
175
+ align-items: center;
176
+ width: 18px;
177
+ height: 58px;
178
+ padding: 0;
179
+ display: flex;
180
+ position: absolute;
181
+ top: 50%;
182
+ transform: translateY(-50%);
183
+ }
184
+
185
+ .dc-sidebar-toggle--left {
186
+ right: -17px;
187
+ }
188
+
189
+ .dc-sidebar-toggle--right {
190
+ left: -17px;
191
+ }
192
+
193
+ .dc-designer--compact .dc-designer__body {
194
+ grid-template-columns: minmax(0, 1fr);
195
+ }
196
+
197
+ .dc-designer--compact .dc-designer__panel--center {
198
+ grid-area: 1 / 1;
199
+ }
200
+
201
+ .dc-designer--compact .dc-designer__panel--left, .dc-designer--compact .dc-designer__panel--right {
202
+ z-index: 802;
203
+ width: min(var(--_dc-workspace-drawer-width), calc(100% - 48px));
204
+ max-width: 100%;
205
+ position: absolute;
206
+ top: 0;
207
+ bottom: 0;
208
+ }
209
+
210
+ .dc-designer--compact .dc-designer__panel--left {
211
+ left: 0;
212
+ transform: translateX(-100%);
213
+ }
214
+
215
+ .dc-designer--compact .dc-designer__panel--right {
216
+ right: 0;
217
+ transform: translateX(100%);
218
+ }
219
+
220
+ .dc-designer--compact .dc-designer__panel--open {
221
+ transform: translateX(0);
222
+ }
223
+
224
+ .dc-workspace-backdrop {
225
+ z-index: 801;
226
+ cursor: default;
227
+ border: 0;
228
+ padding: 0;
229
+ position: absolute;
230
+ inset: 0;
231
+ }
232
+
233
+ .dc-material-panel, .dc-structure-panel, .dc-property-panel {
234
+ flex-direction: column;
235
+ min-width: 0;
236
+ height: 100%;
237
+ display: flex;
238
+ overflow: hidden;
239
+ }
240
+
241
+ .dc-material-panel__header, .dc-structure-panel__header {
242
+ flex: none;
243
+ align-items: center;
244
+ height: 48px;
245
+ padding: 0 14px;
246
+ display: flex;
247
+ }
248
+
249
+ .dc-material-panel__heading {
250
+ margin: 0;
251
+ }
252
+
253
+ .dc-material-panel__search {
254
+ flex: none;
255
+ align-items: center;
256
+ margin: 0 12px 10px;
257
+ display: flex;
258
+ position: relative;
259
+ }
260
+
261
+ .dc-material-panel__search-icon {
262
+ z-index: 1;
263
+ pointer-events: none;
264
+ position: absolute;
265
+ left: 9px;
266
+ }
267
+
268
+ .dc-material-panel__search-input {
269
+ width: 100%;
270
+ height: var(--dc-control-height-md, 32px);
271
+ padding: 0 30px;
272
+ }
273
+
274
+ .dc-material-panel__search-clear {
275
+ cursor: pointer;
276
+ border: 0;
277
+ justify-content: center;
278
+ align-items: center;
279
+ width: 24px;
280
+ height: 24px;
281
+ padding: 0;
282
+ display: inline-flex;
283
+ position: absolute;
284
+ right: 4px;
285
+ }
286
+
287
+ .dc-material-panel__groups {
288
+ flex: 1;
289
+ min-height: 0;
290
+ padding: 0 8px 12px;
291
+ overflow: hidden auto;
292
+ }
293
+
294
+ .dc-material-group + .dc-material-group {
295
+ margin-top: 4px;
296
+ }
297
+
298
+ .dc-material-group__header {
299
+ cursor: pointer;
300
+ border: 0;
301
+ justify-content: space-between;
302
+ align-items: center;
303
+ width: 100%;
304
+ min-height: 34px;
305
+ padding: 0 6px;
306
+ display: flex;
307
+ }
308
+
309
+ .dc-material-group__title, .dc-material-item__title, .dc-structure-panel__title, .dc-structure-panel__id, .dc-structure-panel__region-title {
310
+ text-overflow: ellipsis;
311
+ white-space: nowrap;
312
+ overflow: hidden;
313
+ }
314
+
315
+ .dc-material-group__toggle {
316
+ flex: none;
317
+ display: inline-flex;
318
+ }
319
+
320
+ .dc-material-group__toggle--collapsed {
321
+ transform: rotate(-90deg);
322
+ }
323
+
324
+ .dc-material-group__body {
325
+ grid-template-columns: repeat(2, minmax(0, 1fr));
326
+ gap: 8px;
327
+ min-width: 0;
328
+ padding: 4px 4px 10px;
329
+ display: grid;
330
+ }
331
+
332
+ .dc-material-item {
333
+ cursor: grab;
334
+ user-select: none;
335
+ flex-direction: column;
336
+ justify-content: center;
337
+ align-items: center;
338
+ gap: 7px;
339
+ width: 100%;
340
+ min-width: 0;
341
+ min-height: 72px;
342
+ padding: 9px 6px;
343
+ display: flex;
344
+ overflow: hidden;
345
+ }
346
+
347
+ .dc-material-item:active {
348
+ cursor: grabbing;
349
+ }
350
+
351
+ .dc-material-item__icon {
352
+ width: var(--dc-control-height-sm, 28px);
353
+ height: var(--dc-control-height-sm, 28px);
354
+ flex: none;
355
+ justify-content: center;
356
+ align-items: center;
357
+ display: inline-flex;
358
+ overflow: hidden;
359
+ }
360
+
361
+ .dc-material-item__thumbnail {
362
+ object-fit: cover;
363
+ width: 40px;
364
+ height: 30px;
365
+ }
366
+
367
+ .dc-material-item__content, .dc-material-item__title {
368
+ width: 100%;
369
+ min-width: 0;
370
+ }
371
+
372
+ .dc-material-item__title {
373
+ text-align: center;
374
+ display: block;
375
+ }
376
+
377
+ .dc-structure-panel__list {
378
+ flex: 1;
379
+ min-height: 0;
380
+ padding: 4px 8px 12px;
381
+ overflow-y: auto;
382
+ }
383
+
384
+ .dc-structure-panel__row {
385
+ min-width: 0;
386
+ }
387
+
388
+ .dc-structure-panel__item {
389
+ align-items: center;
390
+ width: 100%;
391
+ min-height: 42px;
392
+ padding: 3px;
393
+ display: flex;
394
+ }
395
+
396
+ .dc-structure-panel__select {
397
+ text-align: left;
398
+ cursor: pointer;
399
+ border: 0;
400
+ flex: 1;
401
+ align-items: center;
402
+ gap: 8px;
403
+ min-width: 0;
404
+ min-height: 34px;
405
+ padding: 3px;
406
+ display: flex;
407
+ }
408
+
409
+ .dc-structure-panel__branch {
410
+ flex: none;
411
+ width: 13px;
412
+ height: 20px;
413
+ }
414
+
415
+ .dc-structure-panel__main {
416
+ flex-direction: column;
417
+ flex: 1;
418
+ gap: 1px;
419
+ min-width: 0;
420
+ display: flex;
421
+ }
422
+
423
+ .dc-structure-panel__title, .dc-structure-panel__id {
424
+ display: block;
425
+ }
426
+
427
+ .dc-structure-panel__actions {
428
+ flex: none;
429
+ align-items: center;
430
+ display: flex;
431
+ }
432
+
433
+ .dc-structure-panel__action {
434
+ width: 28px;
435
+ height: var(--dc-control-height-sm, 28px);
436
+ cursor: pointer;
437
+ border: 0;
438
+ flex: none;
439
+ justify-content: center;
440
+ align-items: center;
441
+ padding: 0;
442
+ display: inline-flex;
443
+ }
444
+
445
+ .dc-structure-panel__action:disabled {
446
+ cursor: not-allowed;
447
+ }
448
+
449
+ .dc-structure-panel__region {
450
+ grid-template-columns: 16px minmax(0, 1fr) auto;
451
+ align-items: center;
452
+ min-height: 28px;
453
+ padding-inline: 20px 8px;
454
+ display: grid;
455
+ }
456
+
457
+ .dc-structure-panel__region-branch-mark {
458
+ width: 9px;
459
+ height: 14px;
460
+ }
461
+
462
+ .dc-structure-panel__region-count {
463
+ text-align: end;
464
+ min-width: 16px;
465
+ }
466
+
467
+ .dc-structure-panel__children {
468
+ padding-inline-start: 16px;
469
+ }
470
+
471
+ .dc-structure-panel__empty, .dc-property-panel__empty {
472
+ text-align: center;
473
+ justify-content: center;
474
+ align-items: center;
475
+ display: flex;
476
+ }
477
+
478
+ .dc-structure-panel__empty {
479
+ flex: 1;
480
+ padding: 16px;
481
+ }
482
+
483
+ .dc-property-panel__content {
484
+ flex: 1;
485
+ min-height: 0;
486
+ padding: 8px 0 16px;
487
+ overflow-y: auto;
488
+ }
489
+
490
+ .dc-property-panel__empty {
491
+ min-height: 120px;
492
+ }
493
+
494
+ .dc-canvas {
495
+ min-width: 0;
496
+ height: 100%;
497
+ min-height: 0;
498
+ position: relative;
499
+ overflow: hidden;
500
+ }
501
+
502
+ .dc-canvas-controls {
503
+ z-index: 100;
504
+ pointer-events: none;
505
+ min-width: 0;
506
+ position: absolute;
507
+ inset: 0;
508
+ }
509
+
510
+ .dc-canvas-controls__history {
511
+ pointer-events: auto;
512
+ align-items: center;
513
+ gap: 2px;
514
+ padding: 3px;
515
+ display: inline-flex;
516
+ position: absolute;
517
+ top: 12px;
518
+ left: 12px;
519
+ }
520
+
521
+ .dc-canvas-controls__button {
522
+ width: var(--dc-control-height-sm, 28px);
523
+ height: var(--dc-control-height-sm, 28px);
524
+ cursor: pointer;
525
+ justify-content: center;
526
+ align-items: center;
527
+ padding: 0;
528
+ display: inline-flex;
529
+ }
530
+
531
+ .dc-canvas-controls__divider {
532
+ width: 1px;
533
+ height: 18px;
534
+ margin: 0 2px;
535
+ }
536
+
537
+ .dc-canvas-controls__button:disabled {
538
+ cursor: not-allowed;
539
+ }
540
+
541
+ .dc-canvas__viewport {
542
+ position: absolute;
543
+ inset: 0;
544
+ overflow: hidden;
545
+ }
546
+
547
+ .dc-canvas__stage {
548
+ width: max-content;
549
+ height: max-content;
550
+ transform: translate3d(-50%, -50%, 0)
551
+ translate3d(var(--_dc-canvas-pan-x, 0px), var(--_dc-canvas-pan-y, 0px), 0)
552
+ translate3d(var(--_dc-canvas-snap-x, 0px), var(--_dc-canvas-snap-y, 0px), 0);
553
+ transform-origin: center;
554
+ will-change: transform;
555
+ position: absolute;
556
+ top: 50%;
557
+ left: 50%;
558
+ }
559
+
560
+ .dc-canvas__content {
561
+ width: max-content;
562
+ min-width: 375px;
563
+ min-height: 200px;
564
+ display: block;
565
+ }
566
+
567
+ .dc-canvas__content--bounded {
568
+ min-width: 0;
569
+ }
570
+
571
+ .dc-canvas--hand .dc-canvas__viewport, .dc-canvas--hand .dc-canvas__viewport * {
572
+ cursor: grab;
573
+ }
574
+
575
+ .dc-canvas--hand .dc-canvas__viewport {
576
+ touch-action: none;
577
+ }
578
+
579
+ .dc-canvas--panning .dc-canvas__viewport, .dc-canvas--panning .dc-canvas__viewport * {
580
+ cursor: grabbing;
581
+ user-select: none;
582
+ }
583
+
584
+ .dc-canvas__content > .dc-root-renderer {
585
+ width: max-content;
586
+ min-width: 375px;
587
+ min-height: 200px;
588
+ display: flow-root;
589
+ }
590
+
591
+ .dc-canvas__content--bounded > .dc-root-renderer {
592
+ min-width: 0;
593
+ }
594
+
595
+ .dc-canvas__content > .dc-root-renderer > [data-dc-toolbar-boundary] {
596
+ margin-block: 0;
597
+ margin-inline: auto;
598
+ }
599
+
600
+ .dc-canvas__interaction-layer {
601
+ z-index: 90;
602
+ pointer-events: none;
603
+ position: absolute;
604
+ inset: 0;
605
+ }
606
+
607
+ .dc-canvas__interaction-layer > * {
608
+ pointer-events: auto;
609
+ }
610
+
611
+ .dc-canvas--forbidden {
612
+ cursor: not-allowed;
613
+ }
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@dragcraft/designer",
3
+ "type": "module",
4
+ "version": "0.0.1",
5
+ "description": "@dragcraft/designer",
6
+ "author": "hackycy <hackycy@outlook.com>",
7
+ "license": "MIT",
8
+ "homepage": "https://github.com/hackycy/dragcraft#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/hackycy/dragcraft.git"
12
+ },
13
+ "bugs": "https://github.com/hackycy/dragcraft/issues",
14
+ "keywords": [],
15
+ "sideEffects": [
16
+ "**/*.css"
17
+ ],
18
+ "exports": {
19
+ ".": "./dist/index.mjs",
20
+ "./package.json": "./package.json",
21
+ "./structure.css": "./dist/structure.css"
22
+ },
23
+ "main": "./dist/index.mjs",
24
+ "module": "./dist/index.mjs",
25
+ "types": "./dist/index.d.mts",
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "peerDependencies": {
30
+ "vue": ">=3.0.0"
31
+ },
32
+ "dependencies": {
33
+ "@dragcraft/core": "0.0.1",
34
+ "@dragcraft/i18n": "0.0.1",
35
+ "@dragcraft/icons": "0.0.1",
36
+ "@dragcraft/renderer": "0.0.1",
37
+ "@dragcraft/utils": "0.0.1",
38
+ "@dragcraft/form-generator": "0.0.1"
39
+ },
40
+ "devDependencies": {
41
+ "happy-dom": "^20.10.6",
42
+ "vitest": "^4.0.7",
43
+ "vue": "^3.5.27"
44
+ },
45
+ "scripts": {
46
+ "build": "tsdown",
47
+ "dev": "tsdown --watch",
48
+ "lint": "eslint",
49
+ "release": "bumpp",
50
+ "start": "tsx src/index.ts",
51
+ "test": "vitest",
52
+ "typecheck": "tsc"
53
+ }
54
+ }