@magic-spells/cart-panel 0.1.0 → 0.1.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.
- package/README.md +191 -226
- package/dist/cart-panel.cjs.css +51 -10
- package/dist/cart-panel.cjs.js +9 -3
- package/dist/cart-panel.cjs.js.map +1 -1
- package/dist/cart-panel.css +51 -10
- package/dist/cart-panel.esm.css +51 -10
- package/dist/cart-panel.esm.js +9 -3
- package/dist/cart-panel.esm.js.map +1 -1
- package/dist/cart-panel.js +1074 -950
- package/dist/cart-panel.js.map +1 -1
- package/dist/cart-panel.min.css +1 -1
- package/dist/cart-panel.min.js +1 -1
- package/dist/cart-panel.scss +73 -73
- package/package.json +80 -80
- package/src/cart-panel.js +9 -3
- package/src/cart-panel.scss +73 -73
package/package.json
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
2
|
+
"name": "@magic-spells/cart-panel",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Accessible modal shopping cart dialog web component with Shopify integration, focus management, and smooth animations.",
|
|
5
|
+
"author": "Cory Schulz",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "dist/cart-panel.cjs.js",
|
|
9
|
+
"module": "dist/cart-panel.esm.js",
|
|
10
|
+
"unpkg": "dist/cart-panel.min.js",
|
|
11
|
+
"style": "dist/cart-panel.css",
|
|
12
|
+
"sass": "dist/cart-panel.scss",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./dist/cart-panel.esm.js",
|
|
16
|
+
"require": "./dist/cart-panel.cjs.js",
|
|
17
|
+
"default": "./dist/cart-panel.esm.js"
|
|
18
|
+
},
|
|
19
|
+
"./css": "./dist/cart-panel.css",
|
|
20
|
+
"./scss": "./dist/cart-panel.scss"
|
|
21
|
+
},
|
|
22
|
+
"sideEffects": true,
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/magic-spells/cart-panel"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/magic-spells/cart-panel#readme",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/magic-spells/cart-panel/issues"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"cart-panel",
|
|
33
|
+
"web-components",
|
|
34
|
+
"e-commerce",
|
|
35
|
+
"shopping-cart",
|
|
36
|
+
"custom-elements",
|
|
37
|
+
"shopify",
|
|
38
|
+
"modal",
|
|
39
|
+
"dialog",
|
|
40
|
+
"accessibility",
|
|
41
|
+
"a11y"
|
|
42
|
+
],
|
|
43
|
+
"files": [
|
|
44
|
+
"dist/",
|
|
45
|
+
"src/"
|
|
46
|
+
],
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "rollup -c",
|
|
49
|
+
"lint": "eslint src/ rollup.config.mjs",
|
|
50
|
+
"format": "prettier --write .",
|
|
51
|
+
"prepublishOnly": "npm run build",
|
|
52
|
+
"serve": "rollup -c --watch",
|
|
53
|
+
"dev": "rollup -c --watch"
|
|
54
|
+
},
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public",
|
|
57
|
+
"registry": "https://registry.npmjs.org/"
|
|
58
|
+
},
|
|
59
|
+
"browserslist": [
|
|
60
|
+
"last 2 versions",
|
|
61
|
+
"not dead",
|
|
62
|
+
"not ie <= 11"
|
|
63
|
+
],
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@eslint/js": "^8.57.0",
|
|
66
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
67
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
68
|
+
"eslint": "^8.0.0",
|
|
69
|
+
"globals": "^13.24.0",
|
|
70
|
+
"prettier": "^3.3.3",
|
|
71
|
+
"rollup": "^3.0.0",
|
|
72
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
73
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
74
|
+
"rollup-plugin-serve": "^1.1.1",
|
|
75
|
+
"sass": "^1.89.2"
|
|
76
|
+
},
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"@magic-spells/cart-item": "^0.2.1",
|
|
79
|
+
"@magic-spells/event-emitter": "^0.1.0",
|
|
80
|
+
"@magic-spells/focus-trap": "^1.0.6"
|
|
81
|
+
}
|
|
82
82
|
}
|
package/src/cart-panel.js
CHANGED
|
@@ -462,9 +462,15 @@ class CartPanel extends HTMLElement {
|
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
464
|
|
|
465
|
-
customElements.
|
|
466
|
-
customElements.define('cart-
|
|
467
|
-
|
|
465
|
+
if (!customElements.get('cart-dialog')) {
|
|
466
|
+
customElements.define('cart-dialog', CartDialog);
|
|
467
|
+
}
|
|
468
|
+
if (!customElements.get('cart-overlay')) {
|
|
469
|
+
customElements.define('cart-overlay', CartOverlay);
|
|
470
|
+
}
|
|
471
|
+
if (!customElements.get('cart-panel')) {
|
|
472
|
+
customElements.define('cart-panel', CartPanel);
|
|
473
|
+
}
|
|
468
474
|
|
|
469
475
|
export { CartDialog, CartOverlay, CartPanel };
|
|
470
476
|
export default CartDialog;
|
package/src/cart-panel.scss
CHANGED
|
@@ -25,93 +25,93 @@ $cart-transition-timing: cubic-bezier(0.4, 0, 0.2, 1) !default;
|
|
|
25
25
|
|
|
26
26
|
// Define CSS Custom Properties using SCSS values
|
|
27
27
|
:root {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
28
|
+
// Layout
|
|
29
|
+
--cart-dialog-z-index: #{$cart-dialog-z-index};
|
|
30
|
+
--cart-overlay-z-index: #{$cart-overlay-z-index};
|
|
31
|
+
--cart-panel-z-index: #{$cart-panel-z-index};
|
|
32
|
+
--cart-panel-width: #{$cart-panel-width};
|
|
33
|
+
|
|
34
|
+
// Overlay
|
|
35
|
+
--cart-overlay-background: #{$cart-overlay-background};
|
|
36
|
+
--cart-overlay-backdrop-filter: #{$cart-overlay-backdrop-filter};
|
|
37
|
+
|
|
38
|
+
// Panel
|
|
39
|
+
--cart-panel-background: #{$cart-panel-background};
|
|
40
|
+
--cart-panel-shadow: #{$cart-panel-shadow};
|
|
41
|
+
--cart-panel-border-radius: #{$cart-panel-border-radius};
|
|
42
|
+
|
|
43
|
+
// Animation
|
|
44
|
+
--cart-transition-duration: #{$cart-transition-duration};
|
|
45
|
+
--cart-transition-timing: #{$cart-transition-timing};
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// Cart Dialog - Main container
|
|
49
49
|
cart-dialog {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
50
|
+
display: contents;
|
|
51
|
+
|
|
52
|
+
&[aria-hidden='false'] {
|
|
53
|
+
cart-overlay,
|
|
54
|
+
cart-panel {
|
|
55
|
+
pointer-events: auto;
|
|
56
|
+
opacity: 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
cart-panel {
|
|
60
|
+
transform: translateX(0);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
// Cart Overlay - Backdrop
|
|
66
66
|
cart-overlay {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
67
|
+
position: fixed;
|
|
68
|
+
top: 0;
|
|
69
|
+
left: 0;
|
|
70
|
+
width: 100vw;
|
|
71
|
+
height: 100vh;
|
|
72
|
+
opacity: 0;
|
|
73
|
+
pointer-events: none;
|
|
74
|
+
z-index: var(--cart-overlay-z-index);
|
|
75
|
+
background-color: var(--cart-overlay-background);
|
|
76
|
+
backdrop-filter: var(--cart-overlay-backdrop-filter);
|
|
77
|
+
transition:
|
|
78
|
+
opacity var(--cart-transition-duration) var(--cart-transition-timing),
|
|
79
|
+
backdrop-filter var(--cart-transition-duration) var(--cart-transition-timing);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
// Cart Panel - Sliding content area
|
|
83
83
|
cart-panel {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
84
|
+
position: fixed;
|
|
85
|
+
top: 0;
|
|
86
|
+
right: 0;
|
|
87
|
+
width: var(--cart-panel-width);
|
|
88
|
+
height: 100vh;
|
|
89
|
+
opacity: 0;
|
|
90
|
+
transform: translateX(100%);
|
|
91
|
+
pointer-events: none;
|
|
92
|
+
z-index: var(--cart-panel-z-index);
|
|
93
|
+
background: var(--cart-panel-background);
|
|
94
|
+
box-shadow: var(--cart-panel-shadow);
|
|
95
|
+
border-radius: var(--cart-panel-border-radius);
|
|
96
|
+
overflow: hidden;
|
|
97
|
+
transition:
|
|
98
|
+
opacity var(--cart-transition-duration) var(--cart-transition-timing),
|
|
99
|
+
transform var(--cart-transition-duration) var(--cart-transition-timing);
|
|
100
|
+
|
|
101
|
+
// When explicitly hidden, remove from layout
|
|
102
|
+
&.hidden {
|
|
103
|
+
display: none;
|
|
104
|
+
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
// Body scroll lock when cart is open
|
|
108
108
|
body.overflow-hidden {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
109
|
+
overflow: hidden;
|
|
110
|
+
position: fixed;
|
|
111
|
+
width: 100%;
|
|
112
|
+
height: 100%;
|
|
113
|
+
left: 0;
|
|
114
|
+
right: 0;
|
|
115
|
+
margin: 0;
|
|
116
|
+
// The top property will be set dynamically by the component
|
|
117
117
|
}
|