mypgs 1.4.1 → 1.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/README.md +26 -1
- package/dist/index.d.ts +0 -6
- package/package.json +11 -2
- package/plugins/vite-plugin-pgs.d.ts +3 -0
- package/plugins/vite-plugin-pgs.js +7 -2
- package/react.d.ts +11 -0
- package/react.js +1 -0
- package/assets/javascript/pgs.d.ts +0 -76
package/README.md
CHANGED
|
@@ -39,6 +39,21 @@ import { pgs } from "mypgs";
|
|
|
39
39
|
import "mypgs/style.css";
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
In progetti React/TSX con Vite, abilita i tipi JSX e il plugin che converte `pgsHtml` in `pgs`:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import "mypgs/react";
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import react from "@vitejs/plugin-react";
|
|
50
|
+
import pgsVite from "mypgs/vite-plugin-pgs";
|
|
51
|
+
|
|
52
|
+
export default {
|
|
53
|
+
plugins: [pgsVite(), react()],
|
|
54
|
+
};
|
|
55
|
+
```
|
|
56
|
+
|
|
42
57
|
Markup minimo consigliato:
|
|
43
58
|
|
|
44
59
|
```html
|
|
@@ -305,7 +320,17 @@ Il pacchetto espone:
|
|
|
305
320
|
"default": "./dist/javascript/index.js"
|
|
306
321
|
},
|
|
307
322
|
"./style.css": "./dist/css/index.css",
|
|
308
|
-
"./style.min.css": "./dist/css/index.min.css"
|
|
323
|
+
"./style.min.css": "./dist/css/index.min.css",
|
|
324
|
+
"./react": {
|
|
325
|
+
"types": "./react.d.ts",
|
|
326
|
+
"import": "./react.js",
|
|
327
|
+
"default": "./react.js"
|
|
328
|
+
},
|
|
329
|
+
"./vite-plugin-pgs": {
|
|
330
|
+
"types": "./plugins/vite-plugin-pgs.d.ts",
|
|
331
|
+
"import": "./plugins/vite-plugin-pgs.js",
|
|
332
|
+
"default": "./plugins/vite-plugin-pgs.js"
|
|
333
|
+
}
|
|
309
334
|
}
|
|
310
335
|
```
|
|
311
336
|
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mypgs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "MyPGS frontend theme and UI behaviors, with bundled JavaScript and CSS assets.",
|
|
5
5
|
"main": "./dist/javascript/index.js",
|
|
6
6
|
"module": "./assets/javascript/index.js",
|
|
@@ -13,7 +13,16 @@
|
|
|
13
13
|
},
|
|
14
14
|
"./style.css": "./dist/css/index.css",
|
|
15
15
|
"./style.min.css": "./dist/css/index.min.css",
|
|
16
|
-
"./
|
|
16
|
+
"./react": {
|
|
17
|
+
"types": "./react.d.ts",
|
|
18
|
+
"import": "./react.js",
|
|
19
|
+
"default": "./react.js"
|
|
20
|
+
},
|
|
21
|
+
"./vite-plugin-pgs": {
|
|
22
|
+
"types": "./plugins/vite-plugin-pgs.d.ts",
|
|
23
|
+
"import": "./plugins/vite-plugin-pgs.js",
|
|
24
|
+
"default": "./plugins/vite-plugin-pgs.js"
|
|
25
|
+
}
|
|
17
26
|
},
|
|
18
27
|
"style": "./dist/css/index.css",
|
|
19
28
|
"scripts": {
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
export default function pgsVite() {
|
|
2
2
|
return {
|
|
3
3
|
name: "vite-plugin-pgs-html",
|
|
4
|
+
enforce: "pre",
|
|
4
5
|
|
|
5
6
|
transform(code, id) {
|
|
6
7
|
if (!/\.(jsx|tsx)$/.test(id)) return null;
|
|
7
8
|
|
|
9
|
+
const nextCode = code.replace(/\bpgsHtml(\s*)=/g, "pgs$1=");
|
|
10
|
+
|
|
11
|
+
if (nextCode === code) return null;
|
|
12
|
+
|
|
8
13
|
return {
|
|
9
|
-
code:
|
|
14
|
+
code: nextCode,
|
|
10
15
|
map: null,
|
|
11
16
|
};
|
|
12
17
|
},
|
|
13
18
|
};
|
|
14
|
-
}
|
|
19
|
+
}
|
package/react.d.ts
ADDED
package/react.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
type PgsSelectorValue = string | string[];
|
|
3
|
-
type PgsStateValue = string | string[];
|
|
4
|
-
|
|
5
|
-
interface PgsQueryableApi {
|
|
6
|
-
querySelector(value: PgsSelectorValue): Element | null;
|
|
7
|
-
querySelectorAll(value: PgsSelectorValue): NodeListOf<Element>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface PgsStateApi {
|
|
11
|
-
(...values: PgsStateValue[]): PgsStateApi;
|
|
12
|
-
add(...values: PgsStateValue[]): PgsStateApi;
|
|
13
|
-
remove(...values: PgsStateValue[]): PgsStateApi;
|
|
14
|
-
toggle(value: string, force?: boolean): boolean;
|
|
15
|
-
contains(value: string): boolean;
|
|
16
|
-
value: string | null;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface PgsOptionApi {
|
|
20
|
-
contains(key: string): boolean;
|
|
21
|
-
getValueBrackets(key: string): string | undefined;
|
|
22
|
-
value: string | null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface PgsElementApi extends PgsQueryableApi {
|
|
26
|
-
(): PgsElementApi;
|
|
27
|
-
add(...values: string[]): PgsElementApi;
|
|
28
|
-
remove(...values: string[]): PgsElementApi;
|
|
29
|
-
toggle(value: string, force?: boolean): boolean;
|
|
30
|
-
contains(value: string): boolean;
|
|
31
|
-
value: string | null;
|
|
32
|
-
state: PgsStateApi;
|
|
33
|
-
option: PgsOptionApi;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface PgsDocumentApi extends PgsQueryableApi {
|
|
37
|
-
(): PgsDocumentApi;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
type PgsApi = PgsElementApi | PgsDocumentApi;
|
|
41
|
-
|
|
42
|
-
interface PgsFunction {
|
|
43
|
-
(root: Document): PgsDocumentApi;
|
|
44
|
-
(root: Element): PgsElementApi;
|
|
45
|
-
(root: Document | Element): PgsApi;
|
|
46
|
-
registerImport(...modules: unknown[]): PgsFunction;
|
|
47
|
-
registerModules(modules: Record<string, any>): PgsFunction;
|
|
48
|
-
import(...names: string[]): Record<string, any>;
|
|
49
|
-
accordion?: any;
|
|
50
|
-
dropdown?: any;
|
|
51
|
-
menu?: any;
|
|
52
|
-
modal?: any;
|
|
53
|
-
notification?: any;
|
|
54
|
-
slides?: any;
|
|
55
|
-
stepTabs?: any;
|
|
56
|
-
steps?: any;
|
|
57
|
-
summary?: any;
|
|
58
|
-
formValidate?: any;
|
|
59
|
-
scrollHorizontal?: any;
|
|
60
|
-
[moduleName: string]: any;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
interface PgsBag extends PgsElementApi {}
|
|
64
|
-
|
|
65
|
-
namespace React {
|
|
66
|
-
interface HTMLAttributes<T> {
|
|
67
|
-
pgsHtml?: string;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
var pgs: PgsFunction;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function pgs(root: Document): PgsDocumentApi;
|
|
75
|
-
export function pgs(root: Element): PgsElementApi;
|
|
76
|
-
export function pgs(root: Document | Element): PgsApi;
|