@bookklik/senangstart-icons 1.0.3 → 1.0.5

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/index.html CHANGED
@@ -35,7 +35,10 @@
35
35
  <script src="https://unpkg.com/senangwebs-modals@latest/dist/swm.js"></script>
36
36
 
37
37
  <!-- Alpine.js -->
38
- <script src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
38
+ <script
39
+ defer
40
+ src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"
41
+ ></script>
39
42
 
40
43
  <!-- Tailwind CSS -->
41
44
  <script src="https://cdn.tailwindcss.com"></script>
@@ -94,7 +97,7 @@
94
97
  }
95
98
 
96
99
  .swj-button {
97
- @apply bg-brand-600 text-white;
100
+ @apply bg-brand-600 text-white text-xs font-medium tracking-widest uppercase px-2 py-1 absolute top-1/2 -translate-y-1/2 right-2 rounded opacity-80 hover:opacity-100;
98
101
  }
99
102
 
100
103
  .swj-btn .swj-button {
@@ -242,21 +245,34 @@
242
245
  ></div>
243
246
  <pre
244
247
  class="bg-slate-900 text-slate-50 p-5 rounded-r-lg rounded-l-md overflow-x-auto font-mono text-sm shadow-xl"
245
- ><code data-swj-id="code-install" data-swj-value>npm install senangstart-icons</code></pre>
248
+ ><code>npm i @bookklik/senangstart-icons</code></pre>
246
249
  </div>
247
- <div class="flex justify-end w-full mt-2">
248
- <button
249
- type="button"
250
- class="absolute inset-y-0 top-2 right-2 w-8 h-8 bg-brand-600 rounded flex items-center justify-center"
251
- data-swj-copy="code-install"
252
- ></button>
250
+ </div>
251
+
252
+ <div class="mb-8">
253
+ <div class="flex items-center justify-between mb-3">
254
+ <span class="text-sm font-semibold text-slate-900"
255
+ >Class Name CDN</span
256
+ >
257
+ <span
258
+ class="text-xs text-brand-600 bg-blue-50 px-2 py-0.5 rounded border border-blue-100"
259
+ >Recommended for static sites</span
260
+ >
261
+ </div>
262
+ <div class="relative group">
263
+ <div
264
+ class="absolute inset-y-0 left-0 w-1 bg-slate-600 rounded-l-lg"
265
+ ></div>
266
+ <pre
267
+ class="bg-slate-900 text-slate-50 p-5 rounded-r-lg rounded-l-md overflow-x-auto font-mono text-sm shadow-xl"
268
+ ><code>&lt;link rel="stylesheet" href="https://unpkg.com/@bookklik/senangstart-icons/dist/senangstart.min.css" /&gt;</code></pre>
253
269
  </div>
254
270
  </div>
255
271
 
256
272
  <div>
257
273
  <div class="flex items-center justify-between mb-3">
258
274
  <span class="text-sm font-semibold text-slate-900"
259
- >CDN Link</span
275
+ >Web Component CDN</span
260
276
  >
261
277
  <span
262
278
  class="text-xs text-brand-600 bg-blue-50 px-2 py-0.5 rounded border border-blue-100"
@@ -269,8 +285,7 @@
269
285
  ></div>
270
286
  <pre
271
287
  class="bg-slate-900 text-slate-50 p-5 rounded-r-lg rounded-l-md overflow-x-auto font-mono text-sm shadow-xl"
272
- ><code>&lt;link rel="stylesheet" href="https://cdn.example.com/senangstart.min.css" /&gt;
273
- &lt;script src="https://cdn.example.com/senangstart-icon.min.js"&gt;&lt;/script&gt;</code></pre>
288
+ ><code>&lt;script src="https://unpkg.com/@bookklik/senangstart-icons/dist/senangstart-icon.min.js"&gt;&lt;/script&gt;</code></pre>
274
289
  </div>
275
290
  </div>
276
291
  </div>
@@ -453,20 +468,23 @@
453
468
  <ss-icon icon="${slug}" thickness="${thickness}"></ss-icon>
454
469
  </div>
455
470
  <div class="flex flex-col gap-2 justify-between flex-grow lg:h-48">
456
- <div class="relative group">
457
- <div class="absolute inset-y-0 left-0 w-1 bg-brand-600 rounded-l-lg"></div>
458
- <pre class="bg-slate-900 text-slate-50 p-5 rounded-r-lg rounded-l-md overflow-x-auto font-mono text-sm shadow-xl max-w-[calc(100vw-4rem)]"><code>&#x3C;ss-icon icon=&#x22;${slug}&#x22; thickness=&#x22;${thickness}&#x22;&#x3E;&#x3C;/ss-icon&#x3E;
459
- &#x3C;i class=&#x22;ss ss-${slug}&#x22;&#x3E;&#x3C;/i&#x3E;</code></pre>
471
+ <div class="relative h-12">
472
+ <pre class="bg-slate-900 text-slate-50 h-12 flex items-center p-3 rounded-r-lg rounded-l-md overflow-x-auto font-mono text-sm shadow-xl max-w-[calc(100vw-4rem)]"><code>&#x3C;ss-icon icon=&#x22;${slug}&#x22; thickness=&#x22;${thickness}&#x22;&#x3E;&#x3C;/ss-icon&#x3E;</code></pre>
473
+ <textarea id="js-copy-code-${slug}" class="w-0 h-0" data-swj-id="js-copy-code-${slug}" data-swj-value><ss-icon icon="${slug}" thickness="${thickness}"></ss-icon></textarea>
474
+ <button
475
+ type="button"
476
+ data-swj-copy="js-copy-code-${slug}"
477
+ >Copy</button>
460
478
  </div>
461
- <div class="text-xs text-slate-400 mb-auto">tags: ${tags}</div>
462
- <textarea id="copy-code-${slug}" class="w-0 h-0" data-swj-id="copy-code-${slug}" data-swj-value><ss-icon icon="${slug}" thickness="${thickness}"></ss-icon></textarea>
463
- <div class="flex items-center justify-center lg:justify-end">
464
- <button
465
- type="button"
466
- class="bg-brand-600 rounded flex items-center justify-center text-white px-2 py-1"
467
- data-swj-copy="copy-code-${slug}"
468
- >Copy</button>
479
+ <div class="relative h-12">
480
+ <pre class="bg-slate-900 text-slate-50 h-12 flex items-center p-3 rounded-r-lg rounded-l-md overflow-x-auto font-mono text-sm shadow-xl max-w-[calc(100vw-4rem)]"><code>&#x3C;i class=&#x22;ss ss-${slug}&#x22;&#x3E;&#x3C;/i&#x3E;</code></pre>
481
+ <textarea id="css-copy-code-${slug}" class="w-0 h-0" data-swj-id="css-copy-code-${slug}" data-swj-value><i class="ss ss-${slug}"></i></textarea>
482
+ <button
483
+ type="button"
484
+ data-swj-copy="css-copy-code-${slug}"
485
+ >Copy</button>
469
486
  </div>
487
+ <div class="text-sm text-slate-400 mt-auto">tags: ${tags}</div>
470
488
  </div>
471
489
  </div>`,
472
490
  position: "top",
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@bookklik/senangstart-icons",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Curated Starter icons designed for web projects.",
5
5
  "main": "dist/senangstart-icon.min.js",
6
6
  "scripts": {
7
7
  "build:svg": "node scripts/build-svgs.js",
8
- "build": "npm run build:svg && webpack --mode production",
9
- "build:watch": "npm run build:svg && webpack --mode production --watch",
10
- "dev": "npm run build:svg && webpack --mode development --watch",
8
+ "build:css": "node scripts/build-css.js",
9
+ "build": "npm run build:svg && npm run build:css && webpack --mode production",
10
+ "build:watch": "npm run build:svg && npm run build:css && webpack --mode production --watch",
11
+ "dev": "npm run build:svg && npm run build:css && webpack --mode development --watch",
11
12
  "test": "echo \"Error: no test specified\" && exit 1"
12
13
  },
13
14
  "keywords": [
package/preview.png ADDED
Binary file
@@ -0,0 +1,82 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
4
+ const iconsPath = path.resolve(__dirname, "../src/icons.json");
5
+ const outputPath = path.resolve(__dirname, "../src/icons.css");
6
+
7
+ // Read icons.json
8
+ const icons = JSON.parse(fs.readFileSync(iconsPath, "utf8"));
9
+
10
+ // URL-encode SVG for data URI
11
+ function encodeSvg(svg) {
12
+ return svg
13
+ .replace(/"/g, "'")
14
+ .replace(/%/g, "%25")
15
+ .replace(/#/g, "%23")
16
+ .replace(/{/g, "%7B")
17
+ .replace(/}/g, "%7D")
18
+ .replace(/</g, "%3C")
19
+ .replace(/>/g, "%3E")
20
+ .replace(/\s+/g, " ")
21
+ .trim();
22
+ }
23
+
24
+ // Generate SVG string from icon data
25
+ function generateSvg(icon) {
26
+ const { src, viewBox, fill, stroke, strokeWidth } = icon;
27
+
28
+ // Default values
29
+ const vBox = viewBox || "0 0 24 24";
30
+ const fl = fill || "none";
31
+ const strk = stroke || "currentColor";
32
+ const strkWidth = strokeWidth || "2";
33
+
34
+ return `<svg xmlns='http://www.w3.org/2000/svg' viewBox='${vBox}' fill='${fl}' stroke='${strk}' stroke-width='${strkWidth}' stroke-linecap='round' stroke-linejoin='round'><path d='${src}'/></svg>`;
35
+ }
36
+
37
+ // Base CSS styles
38
+ const baseCss = `/* Senangstart Icons - CSS Only */
39
+ /* Auto-generated - Do not edit manually */
40
+
41
+ .ss {
42
+ display: inline-block;
43
+ width: 1em;
44
+ height: 1em;
45
+ vertical-align: middle;
46
+ background-color: currentColor;
47
+ -webkit-mask-size: contain;
48
+ mask-size: contain;
49
+ -webkit-mask-repeat: no-repeat;
50
+ mask-repeat: no-repeat;
51
+ -webkit-mask-position: center;
52
+ mask-position: center;
53
+ }
54
+
55
+ .ss svg {
56
+ display: none;
57
+ }
58
+
59
+ `;
60
+
61
+ // Generate icon CSS classes
62
+ let iconCss = "";
63
+
64
+ icons.forEach((icon) => {
65
+ const { slug } = icon;
66
+ const svg = generateSvg(icon);
67
+ const encodedSvg = encodeSvg(svg);
68
+ const dataUri = `url("data:image/svg+xml,${encodedSvg}")`;
69
+
70
+ iconCss += `.ss-${slug} {
71
+ -webkit-mask-image: ${dataUri};
72
+ mask-image: ${dataUri};
73
+ }
74
+
75
+ `;
76
+ });
77
+
78
+ // Write CSS file
79
+ const fullCss = baseCss + iconCss;
80
+ fs.writeFileSync(outputPath, fullCss);
81
+
82
+ console.log(`Generated icons.css with ${icons.length} icons`);