yummies 5.4.8 → 5.5.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/css.cjs CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.cva = exports.cx = exports.toRem = void 0;
6
+ exports.loadCssFile = exports.cva = exports.cx = exports.toRem = void 0;
7
7
  const class_variance_authority_1 = require("class-variance-authority");
8
8
  const clsx_1 = __importDefault(require("clsx"));
9
9
  const tailwind_merge_1 = require("tailwind-merge");
@@ -26,3 +26,39 @@ exports.cva = ((...args) => {
26
26
  const schema = (0, class_variance_authority_1.cva)(...args);
27
27
  return (...inputArgs) => (0, tailwind_merge_1.twMerge)(schema(...inputArgs));
28
28
  });
29
+ /**
30
+ * Load CSS file by providing `url`.
31
+ *
32
+ * **NOTE:** If `id` is provided, it will remove the existing link element with the same `id` before creating a new one.
33
+ */
34
+ const loadCssFile = (url, attrubutes) => new Promise((resolve, reject) => {
35
+ let link;
36
+ if (attrubutes?.id) {
37
+ link = document.getElementById(attrubutes.id);
38
+ if (link) {
39
+ link.remove();
40
+ }
41
+ }
42
+ link = document.createElement('link');
43
+ const handleLoad = () => {
44
+ resolve(undefined);
45
+ link.removeEventListener('load', handleLoad);
46
+ link.removeEventListener('error', handleError);
47
+ };
48
+ const handleError = () => {
49
+ reject(undefined);
50
+ link.removeEventListener('load', handleLoad);
51
+ link.removeEventListener('error', handleError);
52
+ };
53
+ link.addEventListener('load', handleLoad);
54
+ link.addEventListener('error', handleError);
55
+ link.setAttribute('href', url);
56
+ if (!attrubutes?.rel) {
57
+ link.setAttribute('rel', 'stylesheet');
58
+ }
59
+ Object.entries(attrubutes || {}).forEach(([key, value]) => {
60
+ link.setAttribute(key, value);
61
+ });
62
+ document.head.appendChild(link);
63
+ });
64
+ exports.loadCssFile = loadCssFile;
package/css.d.cts CHANGED
@@ -33,4 +33,10 @@ type Props<T> = T extends ConfigSchema ? ConfigVariants<T> & ClassProp : ClassPr
33
33
  export declare const cva: <T>(base?: ClassValue, config?: Config<T>) => (props?: Props<T>) => string;
34
34
  export type { VariantProps } from 'class-variance-authority';
35
35
  export type { ClassValue } from 'clsx';
36
+ /**
37
+ * Load CSS file by providing `url`.
38
+ *
39
+ * **NOTE:** If `id` is provided, it will remove the existing link element with the same `id` before creating a new one.
40
+ */
41
+ export declare const loadCssFile: (url: string, attrubutes?: Record<string, any>) => Promise<unknown>;
36
42
  //# sourceMappingURL=css.d.ts.map
package/css.d.cts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../src/css.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,EAAE,EAAE,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C,KAAK,SAAS,GAAG;IACf,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,SAAS,CAAC,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,KAAK,eAAe,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,CAAC,CAAC;AAEnE;;GAEG;AACH,eAAO,MAAM,KAAK,GAAI,IAAI,MAAM,EAAE,iBAAa,WAA0B,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,EAAE,GAAI,GAAG,MAAM,UAAU,CAAC,OAAO,IAAI,CAAC,WAA2B,CAAC;AAE/E,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AAC/D,KAAK,cAAc,CAAC,CAAC,SAAS,YAAY,IAAI;KAC3C,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS;CAC5E,CAAC;AACF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AAEd;;;;GAIG;AACH,eAAO,MAAM,GAAG,EAGH,CAAC,CAAC,EACb,IAAI,CAAC,EAAE,UAAU,EACjB,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,KACf,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC;AAElC,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,qBAwCrE,CAAC"}
package/css.d.ts CHANGED
@@ -33,4 +33,10 @@ type Props<T> = T extends ConfigSchema ? ConfigVariants<T> & ClassProp : ClassPr
33
33
  export declare const cva: <T>(base?: ClassValue, config?: Config<T>) => (props?: Props<T>) => string;
34
34
  export type { VariantProps } from 'class-variance-authority';
35
35
  export type { ClassValue } from 'clsx';
36
+ /**
37
+ * Load CSS file by providing `url`.
38
+ *
39
+ * **NOTE:** If `id` is provided, it will remove the existing link element with the same `id` before creating a new one.
40
+ */
41
+ export declare const loadCssFile: (url: string, attrubutes?: Record<string, any>) => Promise<unknown>;
36
42
  //# sourceMappingURL=css.d.ts.map
package/css.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../src/css.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,EAAE,EAAE,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C,KAAK,SAAS,GAAG;IACf,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,SAAS,CAAC,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,KAAK,eAAe,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,CAAC,CAAC;AAEnE;;GAEG;AACH,eAAO,MAAM,KAAK,GAAI,IAAI,M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C,SAAS,YAAY,GACnC;IACE,QAAQ,CAAC,EAAE,CAAC,CAAC;IACb,eAAe,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IACpC,gBAAgB,CAAC,EAAE,CAAC,CAAC,SAAS,YAAY,GACtC,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,GACxD,SAAS,CAAC,EAAE,CAAC;CAClB,GACD,KAAK,CAAC;AAEV,KAAK,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,YAAY,GAClC,cAAc,CAAC,CAAC,CAAC,GAAG,SAAS,GAC7B,SAAS,CAAC;AAEd;;;;GAIG;AACH,eAAO,MAAM,GAAG,EAGH,CAAC,CAAC,EACb,IAAI,CAAC,EAAE,UAAU,EACjB,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,KACf,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC;AAElC,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,qBAwCrE,CAAC"}
package/css.js CHANGED
@@ -18,3 +18,38 @@ export const cva = ((...args) => {
18
18
  const schema = cvaLib(...args);
19
19
  return (...inputArgs) => twMerge(schema(...inputArgs));
20
20
  });
21
+ /**
22
+ * Load CSS file by providing `url`.
23
+ *
24
+ * **NOTE:** If `id` is provided, it will remove the existing link element with the same `id` before creating a new one.
25
+ */
26
+ export const loadCssFile = (url, attrubutes) => new Promise((resolve, reject) => {
27
+ let link;
28
+ if (attrubutes?.id) {
29
+ link = document.getElementById(attrubutes.id);
30
+ if (link) {
31
+ link.remove();
32
+ }
33
+ }
34
+ link = document.createElement('link');
35
+ const handleLoad = () => {
36
+ resolve(undefined);
37
+ link.removeEventListener('load', handleLoad);
38
+ link.removeEventListener('error', handleError);
39
+ };
40
+ const handleError = () => {
41
+ reject(undefined);
42
+ link.removeEventListener('load', handleLoad);
43
+ link.removeEventListener('error', handleError);
44
+ };
45
+ link.addEventListener('load', handleLoad);
46
+ link.addEventListener('error', handleError);
47
+ link.setAttribute('href', url);
48
+ if (!attrubutes?.rel) {
49
+ link.setAttribute('rel', 'stylesheet');
50
+ }
51
+ Object.entries(attrubutes || {}).forEach(([key, value]) => {
52
+ link.setAttribute(key, value);
53
+ });
54
+ document.head.appendChild(link);
55
+ });
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "yummies",
3
- "version": "5.4.8",
4
- "keywords": [],
3
+ "version": "5.5.0",
4
+ "keywords": [
5
+ "javascript",
6
+ "typescript",
7
+ "utilities"
8
+ ],
5
9
  "author": "js2me",
6
10
  "license": "MIT",
7
- "description": "",
11
+ "description": "Frontend utilities for JavaScript projects with open source code",
8
12
  "bugs": {
9
13
  "url": "https://github.com/js2me/yummies/issues"
10
14
  },
@@ -43,7 +47,7 @@
43
47
  "@vitest/coverage-istanbul": "^3.1.2",
44
48
  "commitfmt": "^1.0.4",
45
49
  "js2me-biome-config": "^1.0.3",
46
- "sborshik": "^1.0.5",
50
+ "sborshik": "^1.0.10",
47
51
  "jsdom": "^26.1.0",
48
52
  "lefthook": "^1.11.16",
49
53
  "nodemon": "^3.1.9",
@@ -218,8 +222,8 @@
218
222
  "check": "npm run lint:check && npm run ts:check",
219
223
  "prebuild": "npm run clean && npm run check",
220
224
  "build:watch": "pnpm build && nodemon --watch src --ext ts --exec \"pnpm build\"",
221
- "build": "zshy && sborshik fill-dist && tsx scripts/generate-utility-types-file",
222
- "pub": "pnpm build && sborshik publish --openDistDir",
225
+ "build": "sborshik build --fillDist && tsx scripts/generate-utility-types-file",
226
+ "pub": "pnpm build && sborshik publish --useDistDir",
223
227
  "pub:patch": "PUBLISH_VERSION=patch pnpm pub",
224
228
  "pub:minor": "PUBLISH_VERSION=minor pnpm pub",
225
229
  "pub:major": "PUBLISH_VERSION=major pnpm pub",
package/assets/logo.png DELETED
Binary file
package/assets/logo.pxz DELETED
Binary file