mypgs 1.5.0 → 1.6.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/AGENTS.md +6 -3
- package/README.md +22 -373
- package/assets/javascript/_imports.js +4 -0
- package/assets/javascript/_pgs.js +58 -0
- package/assets/javascript/base/_darkmode.js +27 -105
- package/assets/javascript/base/_svg.js +103 -0
- package/assets/javascript/components/_menu.js +1 -3
- package/assets/javascript/components/_search.js +391 -0
- package/assets/javascript/index.js +2 -0
- package/assets/javascript/layout/_header.js +26 -7
- package/assets/scss/base/_color.scss +8 -15
- package/assets/scss/base/_general.scss +36 -48
- package/assets/scss/base/_heading.scss +14 -16
- package/assets/scss/base/_variables.scss +4 -2
- package/assets/scss/components/_card.scss +10 -0
- package/assets/scss/components/_dropdown.scss +2 -1
- package/assets/scss/components/_logo.scss +2 -2
- package/assets/scss/components/_menu.scss +20 -27
- package/assets/scss/components/_modals.scss +11 -1
- package/assets/scss/components/_search.scss +134 -0
- package/assets/scss/index.scss +8 -4
- package/assets/scss/layout/_header.scss +1 -1
- package/assets/scss/layout/_pageShell.scss +1 -0
- package/dist/css/index.css +658 -620
- package/dist/css/index.css.map +1 -1
- package/dist/css/index.min.css +1 -1
- package/dist/index.d.ts +78 -0
- package/dist/javascript/index.js +904 -370
- package/dist/javascript/index.js.map +1 -1
- package/dist/javascript/index.min.js +1 -1
- package/docs/componenti-e-markup.md +90 -0
- package/docs/convenzioni.md +12 -0
- package/docs/export-e-sviluppo.md +109 -0
- package/docs/helper-javascript.md +127 -0
- package/docs/utilizzo-css-scss.md +36 -0
- package/package.json +1 -6
- package/plugins/vite-plugin-pgs.d.ts +10 -0
- package/templates/html/components/logo.html +1 -1
- package/templates/html/components/menu.html +13 -1
- package/templates/html/components/{searchbar.html → search.html} +7 -5
- package/templates/html/demo.js +1 -8
- package/templates/html/layout/header.html +11 -5
- package/templates/react/components/logo.jsx +1 -1
- package/templates/react/components/{searchbar.jsx → search.jsx} +9 -7
- package/templates/react/patterns/header.jsx +16 -10
- package/assets/scss/components/_searchbar.scss +0 -70
- package/react.d.ts +0 -11
- package/react.js +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -17,8 +17,12 @@ declare global {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
interface PgsOptionApi {
|
|
20
|
+
add(...values: PgsStateValue[]): PgsOptionApi;
|
|
21
|
+
remove(...values: PgsStateValue[]): PgsOptionApi;
|
|
22
|
+
toggle(value: string, force?: boolean): boolean;
|
|
20
23
|
contains(key: string): boolean;
|
|
21
24
|
getValueBrackets(key: string): string | undefined;
|
|
25
|
+
setValueBrackets(key: string, value?: string): PgsOptionApi;
|
|
22
26
|
value: string | null;
|
|
23
27
|
}
|
|
24
28
|
|
|
@@ -39,6 +43,71 @@ declare global {
|
|
|
39
43
|
|
|
40
44
|
type PgsApi = PgsElementApi | PgsDocumentApi;
|
|
41
45
|
|
|
46
|
+
type PgsSearchSuggestionInput = string | number | {
|
|
47
|
+
label?: string;
|
|
48
|
+
value?: string | number;
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
data?: unknown;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
interface PgsSearchSuggestion {
|
|
54
|
+
label: string;
|
|
55
|
+
value: string;
|
|
56
|
+
disabled: boolean;
|
|
57
|
+
data: unknown;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface PgsSearchSourceContext {
|
|
61
|
+
query: string;
|
|
62
|
+
signal: AbortSignal;
|
|
63
|
+
limit: number;
|
|
64
|
+
element: Element;
|
|
65
|
+
input: HTMLInputElement;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface PgsSearchSelectDetail {
|
|
69
|
+
item: PgsSearchSuggestion;
|
|
70
|
+
index: number;
|
|
71
|
+
value: string;
|
|
72
|
+
input: HTMLInputElement;
|
|
73
|
+
element: Element;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface PgsSearchOptions {
|
|
77
|
+
minLength: number;
|
|
78
|
+
debounce: number;
|
|
79
|
+
limit: number;
|
|
80
|
+
submitOnSelect: boolean;
|
|
81
|
+
searchOnFocus: boolean;
|
|
82
|
+
source: PgsSearchSuggestionInput[] | ((context: PgsSearchSourceContext) => PgsSearchSuggestionInput[] | Promise<PgsSearchSuggestionInput[]>) | null;
|
|
83
|
+
onSelect: ((detail: PgsSearchSelectDetail) => void) | null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface PgsSearchInstance {
|
|
87
|
+
element: Element;
|
|
88
|
+
input: HTMLInputElement;
|
|
89
|
+
list: Element;
|
|
90
|
+
configure(options: Partial<PgsSearchOptions>): PgsSearchInstance;
|
|
91
|
+
setSource(source: PgsSearchOptions["source"]): PgsSearchInstance;
|
|
92
|
+
search(query?: string): Promise<PgsSearchSuggestion[]>;
|
|
93
|
+
open(): void;
|
|
94
|
+
close(): void;
|
|
95
|
+
clear(): void;
|
|
96
|
+
cancel(): void;
|
|
97
|
+
select(index?: number, submit?: boolean): PgsSearchSuggestion | null;
|
|
98
|
+
refresh(): Promise<PgsSearchSuggestion[]>;
|
|
99
|
+
destroy(): void;
|
|
100
|
+
items(): PgsSearchSuggestion[];
|
|
101
|
+
isOpen(): boolean;
|
|
102
|
+
isLoading(): boolean;
|
|
103
|
+
setActiveIndex(index: number): void;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
interface PgsSearchModule {
|
|
107
|
+
init(root?: Document | Element): void;
|
|
108
|
+
api(selector: Element): PgsSearchInstance | undefined;
|
|
109
|
+
}
|
|
110
|
+
|
|
42
111
|
interface PgsFunction {
|
|
43
112
|
(root: Document): PgsDocumentApi;
|
|
44
113
|
(root: Element): PgsElementApi;
|
|
@@ -51,6 +120,7 @@ declare global {
|
|
|
51
120
|
menu?: any;
|
|
52
121
|
modal?: any;
|
|
53
122
|
notification?: any;
|
|
123
|
+
search?: PgsSearchModule;
|
|
54
124
|
slides?: any;
|
|
55
125
|
stepTabs?: any;
|
|
56
126
|
steps?: any;
|
|
@@ -61,6 +131,14 @@ declare global {
|
|
|
61
131
|
|
|
62
132
|
interface PgsBag extends PgsElementApi {}
|
|
63
133
|
|
|
134
|
+
namespace React {
|
|
135
|
+
interface HTMLAttributes<T> {
|
|
136
|
+
/** Use pgsHtml in JSX/TSX. The Vite plugin converts it to pgs. */
|
|
137
|
+
pgs?: never;
|
|
138
|
+
pgsHtml?: string;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
64
142
|
var pgs: PgsFunction;
|
|
65
143
|
}
|
|
66
144
|
|