@scalable.software/pin 0.2.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/LICENSE +144 -0
- package/README.md +365 -0
- package/dist/.gitkeep +0 -0
- package/dist/Index.d.ts +4 -0
- package/dist/Index.js +2 -0
- package/dist/Pin.d.ts +210 -0
- package/dist/Pin.js +276 -0
- package/dist/Pin.meta.d.ts +104 -0
- package/dist/Pin.meta.js +67 -0
- package/dist/Pin.style.css +122 -0
- package/dist/Pin.template.html +12 -0
- package/package.json +56 -0
- package/report/Pin.report.json +1272 -0
- package/src/Index.ts +25 -0
- package/src/Pin.meta.ts +114 -0
- package/src/Pin.style.css +122 -0
- package/src/Pin.template.html +12 -0
- package/src/Pin.ts +329 -0
@@ -0,0 +1,122 @@
|
|
1
|
+
/* =======================
|
2
|
+
Host Element Styles
|
3
|
+
======================= */
|
4
|
+
:host {
|
5
|
+
/* Light mode color variables */
|
6
|
+
--button-background-color: #ffffff;
|
7
|
+
--button-hover-background-color: #f3f3f3;
|
8
|
+
--button-active-background-color: #e1e1e1;
|
9
|
+
--button-border-color: #d1d1d1;
|
10
|
+
--button-border-hover-color: #a1a1a1;
|
11
|
+
--svg-fill-color: #5a5a5a;
|
12
|
+
--svg-hover-fill-color: #404040;
|
13
|
+
/* Shadow and radius */
|
14
|
+
--button-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
|
15
|
+
--button-radius: 8px;
|
16
|
+
/* Sizes and margins */
|
17
|
+
--icon-size: 40px;
|
18
|
+
--icon-margin: 4px;
|
19
|
+
--svg-size: 24px;
|
20
|
+
--svg-margin: 8px;
|
21
|
+
display: inline-block;
|
22
|
+
}
|
23
|
+
/* Dark Mode Variables */
|
24
|
+
@media (prefers-color-scheme: dark) {
|
25
|
+
:host {
|
26
|
+
/* Dark mode color variables */
|
27
|
+
--button-background-color: #1e1e1e;
|
28
|
+
--button-hover-background-color: #2a2a2a;
|
29
|
+
--button-active-background-color: #333333;
|
30
|
+
--button-border-color: #3c3c3c;
|
31
|
+
--button-border-hover-color: #4a4a4a;
|
32
|
+
--svg-fill-color: #cfcfcf;
|
33
|
+
--svg-hover-fill-color: #ffffff;
|
34
|
+
--button-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
/* =======================
|
38
|
+
Icon Styles
|
39
|
+
======================= */
|
40
|
+
.icon {
|
41
|
+
position: relative;
|
42
|
+
margin: var(--icon-margin);
|
43
|
+
display: inline-flex;
|
44
|
+
align-items: center;
|
45
|
+
justify-content: center;
|
46
|
+
width: var(--icon-size);
|
47
|
+
height: var(--icon-size);
|
48
|
+
background-color: var(--button-background-color);
|
49
|
+
border: 1px solid var(--button-border-color);
|
50
|
+
border-radius: var(--button-radius);
|
51
|
+
box-shadow: var(--button-shadow);
|
52
|
+
cursor: pointer;
|
53
|
+
transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
|
54
|
+
}
|
55
|
+
/* Active state styles for the icon (when clicked or tapped) */
|
56
|
+
.icon:active {
|
57
|
+
background-color: var(--button-active-background-color);
|
58
|
+
border-color: var(--button-border-hover-color);
|
59
|
+
box-shadow: none;
|
60
|
+
}
|
61
|
+
/* =======================
|
62
|
+
Icon Hover Styles
|
63
|
+
======================= */
|
64
|
+
@media (hover: hover) {
|
65
|
+
.icon:hover {
|
66
|
+
background-color: var(--button-hover-background-color);
|
67
|
+
border-color: var(--button-border-hover-color);
|
68
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
/* =======================
|
72
|
+
SVG Icon Styles
|
73
|
+
======================= */
|
74
|
+
svg {
|
75
|
+
margin: var(--svg-margin);
|
76
|
+
width: var(--svg-size);
|
77
|
+
height: var(--svg-size);
|
78
|
+
fill: var(--svg-fill-color);
|
79
|
+
transition: fill 0.2s, opacity 0.2s;
|
80
|
+
}
|
81
|
+
/* Hover effect for the SVG icons */
|
82
|
+
@media (hover: hover) {
|
83
|
+
.icon:hover svg {
|
84
|
+
fill: var(--svg-hover-fill-color);
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
/* =======================
|
89
|
+
State Visibility
|
90
|
+
======================= */
|
91
|
+
.pinned {
|
92
|
+
display: none;
|
93
|
+
}
|
94
|
+
.unpinned {
|
95
|
+
display: inline-block;
|
96
|
+
}
|
97
|
+
:host([visible="no"]) {
|
98
|
+
display: none;
|
99
|
+
}
|
100
|
+
|
101
|
+
/* =======================
|
102
|
+
State: Pinned
|
103
|
+
======================= */
|
104
|
+
:host([status="pinned"]) .icon {
|
105
|
+
background-color: var(--button-active-background-color);
|
106
|
+
border-color: var(--button-border-hover-color);
|
107
|
+
}
|
108
|
+
:host([status="pinned"]) .pinned {
|
109
|
+
display: inline-block;
|
110
|
+
}
|
111
|
+
:host([status="pinned"]) .unpinned {
|
112
|
+
display: none;
|
113
|
+
}
|
114
|
+
/* =======================
|
115
|
+
State: Unpinned
|
116
|
+
======================= */
|
117
|
+
:host([status="unpinned"]) .pinned {
|
118
|
+
display: none;
|
119
|
+
}
|
120
|
+
:host([status="unpinned"]) .unpinned {
|
121
|
+
display: inline-block;
|
122
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<template id="pin-button">
|
2
|
+
<div class="icon">
|
3
|
+
<svg class="pinned" height="24px" width="24px" viewBox="0 0 20 20" fill="#212121">
|
4
|
+
<path
|
5
|
+
d="M2.85355 2.14645C2.65829 1.95118 2.34171 1.95118 2.14645 2.14645C1.95118 2.34171 1.95118 2.65829 2.14645 2.85355L6.896 7.60309L4.01834 8.75415C3.35177 9.02078 3.17498 9.88209 3.68262 10.3897L6.29289 13L3 16.2929V17H3.70711L7 13.7071L9.61027 16.3174C10.1179 16.825 10.9792 16.6482 11.2459 15.9817L12.3969 13.104L17.1464 17.8536C17.3417 18.0488 17.6583 18.0488 17.8536 17.8536C18.0488 17.6583 18.0488 17.3417 17.8536 17.1464L2.85355 2.14645ZM11.6276 12.3347L10.3174 15.6103L4.38973 9.68263L7.66531 8.3724L11.6276 12.3347ZM12.9565 10.7127C12.9294 10.7263 12.9026 10.7403 12.8761 10.7548L13.6202 11.4989L16.8622 9.87793C18.0832 9.26743 18.3473 7.64015 17.382 6.67486L13.3251 2.61804C12.3599 1.65275 10.7326 1.91683 10.1221 3.13783L8.5011 6.37977L9.24523 7.1239C9.25971 7.09739 9.27373 7.07059 9.28728 7.04349L11.0165 3.58504C11.3218 2.97454 12.1354 2.8425 12.618 3.32514L16.6749 7.38197C17.1575 7.86461 17.0255 8.67826 16.415 8.98351L12.9565 10.7127Z" />
|
6
|
+
</svg>
|
7
|
+
<svg class="unpinned" height="24px" width="24px" viewBox="0 0 20 20" fill="#212121">
|
8
|
+
<path
|
9
|
+
d="M10.1221 3.13782C10.7326 1.91683 12.3599 1.65275 13.3251 2.61804L17.382 6.67486C18.3472 7.64015 18.0832 9.26743 16.8622 9.87793L13.4037 11.6072C13.0751 11.7715 12.8183 12.0506 12.6818 12.3917L11.2459 15.9817C10.9792 16.6482 10.1179 16.825 9.61027 16.3174L7 13.7071L3.70711 17H3V16.2929L6.29289 13L3.68262 10.3897C3.17498 9.88209 3.35177 9.02078 4.01834 8.75415L7.60829 7.31817C7.94939 7.18173 8.22855 6.92486 8.39285 6.59628L10.1221 3.13782ZM12.618 3.32514C12.1354 2.8425 11.3217 2.97454 11.0165 3.58504L9.28727 7.04349C9.01345 7.59113 8.54818 8.01925 7.97968 8.24665L4.38973 9.68263L10.3174 15.6103L11.7534 12.0203C11.9808 11.4518 12.4089 10.9866 12.9565 10.7127L16.415 8.9835C17.0255 8.67826 17.1575 7.86461 16.6749 7.38197L12.618 3.32514Z" />
|
10
|
+
</svg>
|
11
|
+
</div>
|
12
|
+
</template>
|
package/package.json
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
{
|
2
|
+
"name": "@scalable.software/pin",
|
3
|
+
"version": "0.2.0",
|
4
|
+
"description": "The Pin component is a button that can be visible or hidden, pinned or unpinned.",
|
5
|
+
"keywords": [
|
6
|
+
"web component",
|
7
|
+
"button"
|
8
|
+
],
|
9
|
+
"exports": {
|
10
|
+
".": {
|
11
|
+
"import": "./dist/Index.js"
|
12
|
+
}
|
13
|
+
},
|
14
|
+
"types": "dist/Index.d.ts",
|
15
|
+
"module": "dist/Index.js",
|
16
|
+
"scripts": {
|
17
|
+
"clean.test": "node ./tasks/clean.test.mjs",
|
18
|
+
"pretest": "npm run clean.test && tsc --project tsconfig.test.json",
|
19
|
+
"test": "karma start",
|
20
|
+
"posttest": "npm run clean.test",
|
21
|
+
"prebuild": "node ./tasks/clean.build.mjs",
|
22
|
+
"build": "tsc --project tsconfig.build.json",
|
23
|
+
"postbuild": "node ./tasks/copy.build.mjs",
|
24
|
+
"preserve": "npm run build",
|
25
|
+
"serve": "web-dev-server --open /demo/index.html",
|
26
|
+
"document": "npx typedoc --tsconfig tsconfig.test.json",
|
27
|
+
"prepublish": "npm run build"
|
28
|
+
},
|
29
|
+
"repository": {
|
30
|
+
"type": "git",
|
31
|
+
"url": "git+https://github.com/scalable-software/pin.git"
|
32
|
+
},
|
33
|
+
"author": "Scalable.Software",
|
34
|
+
"license": "CC-BY-NC-SA-4.0",
|
35
|
+
"bugs": {
|
36
|
+
"url": "https://github.com/scalable-software/pin/issues"
|
37
|
+
},
|
38
|
+
"homepage": "https://github.com/scalable-software/pin#readme",
|
39
|
+
"devDependencies": {
|
40
|
+
"@types/jasmine": "^5.1.4",
|
41
|
+
"@web/dev-server": "^0.4.6",
|
42
|
+
"jasmine": "^5.1.0",
|
43
|
+
"karma": "^6.4.3",
|
44
|
+
"karma-chrome-launcher": "^3.2.0",
|
45
|
+
"karma-coverage-istanbul-instrumenter": "^1.0.4",
|
46
|
+
"karma-coverage-istanbul-reporter": "^3.0.3",
|
47
|
+
"karma-jasmine": "^5.1.0",
|
48
|
+
"karma-spec-reporter": "^0.0.36",
|
49
|
+
"typedoc": "^0.25.13",
|
50
|
+
"typedoc-plugin-merge-modules": "^5.1.0",
|
51
|
+
"typescript": "^5.4.5"
|
52
|
+
},
|
53
|
+
"dependencies": {
|
54
|
+
"@scalable.software/component": "^0.0.4"
|
55
|
+
}
|
56
|
+
}
|