@dragcraft/device-frames 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,591 @@
1
+ :root {
2
+ --dc-device-frame-border-color: #1a1a1a;
3
+ --dc-device-frame-border-width: 3px;
4
+ --dc-device-frame-bg: #fff;
5
+ --dc-device-frame-shadow: 0 0 0 2px #333,
6
+ 0 12px 40px #00000040,
7
+ inset 0 0 0 1px #ffffff1a;
8
+ --dc-device-frame-status-height: 44px;
9
+ --dc-device-frame-status-bg: #fff;
10
+ --dc-device-frame-status-color: #1a1a1a;
11
+ --dc-device-frame-status-font-size: 14px;
12
+ --dc-device-frame-status-border: 1px solid #f0f0f0;
13
+ --dc-device-frame-titlebar-height: 36px;
14
+ --dc-device-frame-titlebar-bg: #e8e8e8;
15
+ --dc-device-frame-urlbar-bg: #fff;
16
+ --dc-device-frame-nav-height: 40px;
17
+ --dc-device-frame-nav-bg: #fafafa;
18
+ --dc-device-picker-gap: 2px;
19
+ --dc-device-picker-btn-bg: transparent;
20
+ --dc-device-picker-btn-color: var(--dc-color-text-muted, #52525b);
21
+ --dc-device-picker-btn-active-bg: var(--dc-color-accent, #18181b);
22
+ --dc-device-picker-btn-active-color: #fff;
23
+ }
24
+
25
+ .dc-device-frame {
26
+ isolation: isolate;
27
+ box-sizing: content-box;
28
+ background: var(--dc-device-frame-bg);
29
+ border-radius: calc(var(--dc-device-frame-radius) - var(--dc-device-frame-border-width));
30
+ box-shadow: none;
31
+ --dc-device-z-chrome-item: 10;
32
+ --dc-device-z-scrollbar: 20;
33
+ --dc-device-z-chrome: 100;
34
+ --dc-device-z-layer: 200;
35
+ --dc-device-z-frame-border: 250;
36
+ --dc-device-z-selection: 300;
37
+ --dc-node-selection-root-block-overlap: var(--dc-node-selection-stroke-width, 2px);
38
+ --dc-node-selection-root-inline-overlap: var(--dc-device-frame-border-width);
39
+ border: 0;
40
+ flex-shrink: 0;
41
+ margin: 24px auto;
42
+ position: relative;
43
+ overflow: visible;
44
+ }
45
+
46
+ .dc-device-frame:after {
47
+ content: "";
48
+ box-sizing: border-box;
49
+ inset: calc(-1 * var(--dc-device-frame-border-width));
50
+ z-index: var(--dc-device-z-frame-border);
51
+ border: var(--dc-device-frame-border-width) solid var(--dc-device-frame-border-color);
52
+ border-radius: var(--dc-device-frame-radius);
53
+ box-shadow: var(--dc-device-frame-shadow);
54
+ pointer-events: none;
55
+ position: absolute;
56
+ }
57
+
58
+ .dc-device-frame__surface {
59
+ border-radius: calc(var(--dc-device-frame-radius) - var(--dc-device-frame-border-width));
60
+ background: var(--dc-device-frame-bg);
61
+ position: relative;
62
+ overflow: hidden;
63
+ }
64
+
65
+ .dc-device-frame__status-bar {
66
+ height: var(--dc-device-frame-status-height);
67
+ background: var(--dc-device-frame-status-bg);
68
+ font-size: var(--dc-device-frame-status-font-size);
69
+ color: var(--dc-device-frame-status-color);
70
+ user-select: none;
71
+ border-bottom: var(--dc-device-frame-status-border);
72
+ justify-content: space-between;
73
+ align-items: center;
74
+ padding: 0 24px;
75
+ font-weight: 600;
76
+ display: flex;
77
+ }
78
+
79
+ .dc-device-frame__status-time {
80
+ font-variant-numeric: tabular-nums;
81
+ }
82
+
83
+ .dc-device-frame__status-icons {
84
+ align-items: center;
85
+ gap: 6px;
86
+ font-size: 12px;
87
+ display: flex;
88
+ }
89
+
90
+ .dc-device-frame__content {
91
+ top: var(--dc-inset-block-start);
92
+ right: var(--dc-inset-inline-end);
93
+ bottom: var(--dc-inset-block-end);
94
+ left: var(--dc-inset-inline-start);
95
+ box-sizing: border-box;
96
+ min-height: 0;
97
+ position: absolute;
98
+ overflow: hidden;
99
+ }
100
+
101
+ .dc-device-frame__content-scroller {
102
+ overscroll-behavior: contain;
103
+ scrollbar-width: none;
104
+ position: absolute;
105
+ inset: 0;
106
+ overflow: hidden auto;
107
+ }
108
+
109
+ .dc-device-frame__content-scroller::-webkit-scrollbar {
110
+ width: 0;
111
+ height: 0;
112
+ }
113
+
114
+ .dc-device-frame__content-layout {
115
+ box-sizing: border-box;
116
+ flex-direction: column;
117
+ min-height: 100%;
118
+ display: flex;
119
+ position: relative;
120
+ }
121
+
122
+ .dc-device-frame__content-row {
123
+ flex: 1 0 auto;
124
+ grid-template-columns: max-content minmax(0, 1fr) max-content;
125
+ min-width: 0;
126
+ min-height: 100%;
127
+ display: grid;
128
+ }
129
+
130
+ .dc-device-frame__content-edge--inline-start {
131
+ grid-column: 1;
132
+ min-width: 0;
133
+ }
134
+
135
+ .dc-device-frame__content-surface {
136
+ box-sizing: border-box;
137
+ grid-column: 2;
138
+ min-width: 0;
139
+ min-height: 100%;
140
+ position: relative;
141
+ }
142
+
143
+ .dc-device-frame__content-edge--inline-end {
144
+ grid-column: 3;
145
+ min-width: 0;
146
+ }
147
+
148
+ .dc-device-frame__selection-plane {
149
+ z-index: var(--dc-device-z-selection);
150
+ pointer-events: none;
151
+ position: absolute;
152
+ overflow: hidden;
153
+ }
154
+
155
+ .dc-device-frame__selection-plane--root {
156
+ inset: calc(-1 * var(--dc-device-frame-border-width));
157
+ border-radius: var(--dc-device-frame-radius);
158
+ }
159
+
160
+ .dc-device-frame__selection-plane--content, .dc-device-frame__selection-plane--viewport {
161
+ inset: 0;
162
+ }
163
+
164
+ .dc-device-frame__scrollbar {
165
+ pointer-events: none;
166
+ width: 3px;
167
+ z-index: var(--dc-device-z-scrollbar);
168
+ position: absolute;
169
+ top: 0;
170
+ bottom: 0;
171
+ right: 2px;
172
+ }
173
+
174
+ .dc-device-frame__scrollbar-thumb {
175
+ opacity: .72;
176
+ background: #00000047;
177
+ border-radius: 999px;
178
+ width: 100%;
179
+ min-height: 24px;
180
+ transition: opacity .15s;
181
+ }
182
+
183
+ .dc-device-frame__viewport {
184
+ --dc-safe-area-block-start: 0px;
185
+ --dc-safe-area-block-end: 0px;
186
+ --dc-safe-area-inline-start: 0px;
187
+ --dc-safe-area-inline-end: 0px;
188
+ --dc-sized-inset-block-start: 0px;
189
+ --dc-sized-inset-block-end: 0px;
190
+ --dc-sized-inset-inline-start: 0px;
191
+ --dc-sized-inset-inline-end: 0px;
192
+ --dc-measured-inset-block-start: 0px;
193
+ --dc-measured-inset-block-end: 0px;
194
+ --dc-measured-inset-inline-start: 0px;
195
+ --dc-measured-inset-inline-end: 0px;
196
+ --dc-inset-block-start: calc(var(--dc-safe-area-block-start) + var(--dc-sized-inset-block-start) + var(--dc-measured-inset-block-start));
197
+ --dc-inset-block-end: calc(var(--dc-safe-area-block-end) + var(--dc-sized-inset-block-end) + var(--dc-measured-inset-block-end));
198
+ --dc-inset-inline-start: calc(var(--dc-safe-area-inline-start) + var(--dc-sized-inset-inline-start) + var(--dc-measured-inset-inline-start));
199
+ --dc-inset-inline-end: calc(var(--dc-safe-area-inline-end) + var(--dc-sized-inset-inline-end) + var(--dc-measured-inset-inline-end));
200
+ position: relative;
201
+ overflow: hidden;
202
+ }
203
+
204
+ .dc-device-frame__chrome {
205
+ z-index: var(--dc-device-z-chrome);
206
+ pointer-events: none;
207
+ position: absolute;
208
+ inset: 0;
209
+ }
210
+
211
+ .dc-device-frame__chrome-item {
212
+ pointer-events: auto;
213
+ min-width: 0;
214
+ z-index: var(--dc-device-z-chrome-item);
215
+ position: relative;
216
+ }
217
+
218
+ .dc-device-frame__chrome-stack {
219
+ pointer-events: none;
220
+ display: flex;
221
+ position: absolute;
222
+ }
223
+
224
+ .dc-device-frame__chrome-stack--block-start {
225
+ flex-direction: column;
226
+ top: 0;
227
+ left: 0;
228
+ right: 0;
229
+ }
230
+
231
+ .dc-device-frame__chrome-stack--block-end {
232
+ flex-direction: column-reverse;
233
+ bottom: 0;
234
+ left: 0;
235
+ right: 0;
236
+ }
237
+
238
+ .dc-device-frame__chrome-stack--inline-start {
239
+ top: var(--dc-inset-block-start);
240
+ bottom: var(--dc-inset-block-end);
241
+ flex-direction: row;
242
+ left: 0;
243
+ }
244
+
245
+ .dc-device-frame__chrome-stack--inline-end {
246
+ top: var(--dc-inset-block-start);
247
+ right: 0;
248
+ bottom: var(--dc-inset-block-end);
249
+ flex-direction: row-reverse;
250
+ }
251
+
252
+ .dc-device-frame__content-layout .dc-device-frame__chrome-item--flow {
253
+ position: relative;
254
+ }
255
+
256
+ .dc-device-frame__content-layout .dc-device-frame__chrome-item--sticky {
257
+ z-index: var(--dc-device-z-chrome-item);
258
+ position: sticky;
259
+ }
260
+
261
+ .dc-device-frame__content-layout .dc-device-frame__chrome--block-start {
262
+ top: 0;
263
+ left: 0;
264
+ right: 0;
265
+ }
266
+
267
+ .dc-device-frame__content-layout .dc-device-frame__chrome--block-end {
268
+ bottom: 0;
269
+ left: 0;
270
+ right: 0;
271
+ }
272
+
273
+ .dc-device-frame__content-layout .dc-device-frame__chrome--inline-start {
274
+ top: 0;
275
+ bottom: 0;
276
+ left: 0;
277
+ }
278
+
279
+ .dc-device-frame__content-layout .dc-device-frame__chrome--inline-end {
280
+ top: 0;
281
+ bottom: 0;
282
+ right: 0;
283
+ }
284
+
285
+ .dc-device-frame__chrome-item > [data-dc-component="node"] {
286
+ border-color: #0000;
287
+ margin: 0;
288
+ padding: 0;
289
+ }
290
+
291
+ .dc-device-frame__layer {
292
+ z-index: var(--dc-device-z-layer);
293
+ pointer-events: none;
294
+ position: absolute;
295
+ inset: 0;
296
+ }
297
+
298
+ .dc-device-frame__layer-item {
299
+ pointer-events: auto;
300
+ position: absolute;
301
+ }
302
+
303
+ .dc-device-frame__layer-item--self {
304
+ pointer-events: none;
305
+ inset: 0;
306
+ }
307
+
308
+ .dc-device-frame__layer-item--self > [data-dc-component="node"] {
309
+ pointer-events: none;
310
+ border-color: #0000;
311
+ margin: 0;
312
+ padding: 0;
313
+ position: absolute;
314
+ inset: 0;
315
+ }
316
+
317
+ .dc-device-frame__layer-item--self > [data-dc-component="node"] > [data-dc-node-surface], .dc-device-frame__layer-item--self > [data-dc-component="node"] > :first-child {
318
+ pointer-events: auto;
319
+ }
320
+
321
+ .dc-device-frame__layer-item--self > [data-dc-component="node"][data-dc-state~="hovered"]:not([data-dc-state~="selected"]), .dc-device-frame__layer-item--self > [data-dc-component="node"][data-dc-state~="selected"] {
322
+ box-shadow: none;
323
+ border-color: #0000;
324
+ }
325
+
326
+ .dc-device-frame > [data-dc-component="forbidden-overlay"] {
327
+ z-index: var(--dc-device-z-selection);
328
+ border-radius: calc(var(--dc-device-frame-radius) - var(--dc-device-frame-border-width));
329
+ }
330
+
331
+ .dc-device-picker {
332
+ align-items: center;
333
+ gap: var(--dc-device-picker-gap);
334
+ border: 1px solid var(--dc-color-border, #d4d4d8);
335
+ border-radius: var(--dc-radius-md, 6px);
336
+ background: var(--dc-color-surface, #fff);
337
+ padding: 2px;
338
+ display: inline-flex;
339
+ }
340
+
341
+ .dc-device-picker__btn {
342
+ height: 24px;
343
+ font-size: 12px;
344
+ font-family: var(--dc-font-sans, inherit);
345
+ border-radius: var(--dc-radius-sm, 4px);
346
+ background: var(--dc-device-picker-btn-bg);
347
+ color: var(--dc-device-picker-btn-color);
348
+ cursor: pointer;
349
+ transition: all var(--dc-duration-normal, .18s);
350
+ white-space: nowrap;
351
+ border: none;
352
+ justify-content: center;
353
+ align-items: center;
354
+ gap: 4px;
355
+ padding: 0 8px;
356
+ display: inline-flex;
357
+ }
358
+
359
+ .dc-device-picker__btn:hover {
360
+ background: var(--dc-color-surface-muted, #f4f4f5);
361
+ color: var(--dc-color-text, #09090b);
362
+ }
363
+
364
+ .dc-device-picker__btn--active {
365
+ background: var(--dc-device-picker-btn-active-bg);
366
+ color: var(--dc-device-picker-btn-active-color);
367
+ }
368
+
369
+ .dc-device-picker__btn--active:hover {
370
+ background: var(--dc-device-picker-btn-active-bg);
371
+ color: var(--dc-device-picker-btn-active-color);
372
+ opacity: .9;
373
+ }
374
+
375
+ .dc-device-frame--iphone {
376
+ --dc-device-frame-radius: 40px;
377
+ width: 375px;
378
+ }
379
+
380
+ .dc-device-frame--iphone .dc-device-frame__viewport {
381
+ height: 812px;
382
+ }
383
+
384
+ .dc-device-frame--iphone .dc-device-frame__status-bar {
385
+ background: var(--dc-device-frame-bg);
386
+ border-bottom: none;
387
+ grid-template-columns: 1fr auto 1fr;
388
+ align-items: center;
389
+ height: 54px;
390
+ padding: 0 28px;
391
+ display: grid;
392
+ }
393
+
394
+ .dc-device-frame--iphone .dc-device-frame__status-time {
395
+ letter-spacing: .5px;
396
+ justify-self: start;
397
+ font-size: 15px;
398
+ font-weight: 600;
399
+ }
400
+
401
+ .dc-device-frame--iphone .dc-device-frame__status-icons {
402
+ justify-self: end;
403
+ align-items: center;
404
+ gap: 5px;
405
+ display: flex;
406
+ }
407
+
408
+ .dc-device-frame--iphone .dc-device-frame__notch--dynamic-island {
409
+ z-index: auto;
410
+ background: #1a1a1a;
411
+ border-radius: 20px;
412
+ width: 120px;
413
+ height: 34px;
414
+ position: static;
415
+ transform: none;
416
+ }
417
+
418
+ .dc-device-frame__cellular {
419
+ align-items: flex-end;
420
+ gap: 1.5px;
421
+ height: 12px;
422
+ display: inline-flex;
423
+ }
424
+
425
+ .dc-device-frame__cellular-bar {
426
+ background: var(--dc-device-frame-status-color, #1a1a1a);
427
+ border-radius: .5px;
428
+ width: 3px;
429
+ display: block;
430
+ }
431
+
432
+ .dc-device-frame__cellular-bar:first-child {
433
+ height: 3px;
434
+ }
435
+
436
+ .dc-device-frame__cellular-bar:nth-child(2) {
437
+ height: 6px;
438
+ }
439
+
440
+ .dc-device-frame__cellular-bar:nth-child(3) {
441
+ height: 9px;
442
+ }
443
+
444
+ .dc-device-frame__cellular-bar:nth-child(4) {
445
+ height: 12px;
446
+ }
447
+
448
+ .dc-device-frame__wifi {
449
+ width: 15px;
450
+ height: 12px;
451
+ color: var(--dc-device-frame-status-color, #1a1a1a);
452
+ display: block;
453
+ }
454
+
455
+ .dc-device-frame__battery {
456
+ border: 1.5px solid var(--dc-device-frame-status-color, #1a1a1a);
457
+ opacity: .9;
458
+ border-radius: 3px;
459
+ align-items: stretch;
460
+ width: 25px;
461
+ height: 12px;
462
+ padding: 2px;
463
+ display: inline-flex;
464
+ position: relative;
465
+ }
466
+
467
+ .dc-device-frame__battery:after {
468
+ content: "";
469
+ background: var(--dc-device-frame-status-color, #1a1a1a);
470
+ opacity: .4;
471
+ border-radius: 0 1.5px 1.5px 0;
472
+ width: 2.5px;
473
+ height: 5px;
474
+ position: absolute;
475
+ top: 50%;
476
+ right: -4px;
477
+ transform: translateY(-50%);
478
+ }
479
+
480
+ .dc-device-frame__battery-level {
481
+ background: var(--dc-device-frame-status-color, #1a1a1a);
482
+ border-radius: 1px;
483
+ width: 100%;
484
+ display: block;
485
+ }
486
+
487
+ .dc-device-frame__home-indicator {
488
+ background: #1a1a1a;
489
+ border-radius: 3px;
490
+ width: 134px;
491
+ height: 5px;
492
+ margin: 8px auto;
493
+ }
494
+
495
+ .dc-device-frame--android {
496
+ --dc-device-frame-radius: 20px;
497
+ width: 360px;
498
+ }
499
+
500
+ .dc-device-frame--android .dc-device-frame__viewport {
501
+ height: 800px;
502
+ }
503
+
504
+ .dc-device-frame__nav-bar {
505
+ height: var(--dc-device-frame-nav-height);
506
+ background: var(--dc-device-frame-nav-bg);
507
+ user-select: none;
508
+ border-top: 1px solid #f0f0f0;
509
+ justify-content: center;
510
+ align-items: center;
511
+ gap: 48px;
512
+ display: flex;
513
+ }
514
+
515
+ .dc-device-frame__nav-btn {
516
+ color: #999;
517
+ cursor: default;
518
+ justify-content: center;
519
+ align-items: center;
520
+ display: inline-flex;
521
+ }
522
+
523
+ .dc-device-frame__nav-btn svg {
524
+ display: block;
525
+ }
526
+
527
+ .dc-device-frame--tablet {
528
+ --dc-device-frame-radius: 24px;
529
+ width: 768px;
530
+ }
531
+
532
+ .dc-device-frame--tablet .dc-device-frame__viewport {
533
+ height: 1024px;
534
+ }
535
+
536
+ .dc-device-frame--desktop {
537
+ --dc-device-frame-radius: 8px;
538
+ --dc-device-frame-shadow: 0 8px 32px #0003;
539
+ width: 1280px;
540
+ }
541
+
542
+ .dc-device-frame--desktop .dc-device-frame__viewport {
543
+ height: 800px;
544
+ }
545
+
546
+ .dc-device-frame__title-bar {
547
+ height: var(--dc-device-frame-titlebar-height);
548
+ background: var(--dc-device-frame-titlebar-bg);
549
+ user-select: none;
550
+ border-bottom: 1px solid #d9d9d9;
551
+ align-items: center;
552
+ gap: 12px;
553
+ padding: 0 12px;
554
+ display: flex;
555
+ }
556
+
557
+ .dc-device-frame__traffic-lights {
558
+ gap: 8px;
559
+ display: flex;
560
+ }
561
+
562
+ .dc-device-frame__traffic-dot {
563
+ border-radius: 50%;
564
+ width: 12px;
565
+ height: 12px;
566
+ }
567
+
568
+ .dc-device-frame__traffic-dot--close {
569
+ background: #ff5f57;
570
+ }
571
+
572
+ .dc-device-frame__traffic-dot--minimize {
573
+ background: #febc2e;
574
+ }
575
+
576
+ .dc-device-frame__traffic-dot--maximize {
577
+ background: #28c840;
578
+ }
579
+
580
+ .dc-device-frame__url-bar {
581
+ background: var(--dc-device-frame-urlbar-bg);
582
+ color: #999;
583
+ border: 1px solid #d9d9d9;
584
+ border-radius: 4px;
585
+ flex: 1;
586
+ align-items: center;
587
+ height: 24px;
588
+ padding: 0 12px;
589
+ font-size: 12px;
590
+ display: flex;
591
+ }
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@dragcraft/device-frames",
3
+ "type": "module",
4
+ "version": "0.0.1",
5
+ "description": "Device frame shells for @dragcraft designer canvas",
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
+ "./styles": "./dist/styles/index.css",
21
+ "./package.json": "./package.json"
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/icons": "0.0.1"
35
+ },
36
+ "devDependencies": {
37
+ "@vue/test-utils": "^2.4.11",
38
+ "happy-dom": "^20.10.6",
39
+ "vitest": "^4.0.7",
40
+ "vue": "^3.5.27"
41
+ },
42
+ "scripts": {
43
+ "build": "tsdown",
44
+ "dev": "tsdown --watch",
45
+ "lint": "eslint",
46
+ "release": "bumpp",
47
+ "start": "tsx src/index.ts",
48
+ "test": "vitest",
49
+ "typecheck": "tsc"
50
+ }
51
+ }