g-ui-core 0.0.1
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/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/g-button.cjs.entry.js +8 -0
- package/dist/cjs/g-ui.cjs.js +25 -0
- package/dist/cjs/index-DOlVX1hU.js +1580 -0
- package/dist/cjs/index.cjs.js +94 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/collection/collection-manifest.json +13 -0
- package/dist/collection/components/my-button/my-button.css +300 -0
- package/dist/collection/components/my-button/my-button.js +522 -0
- package/dist/collection/index.js +1 -0
- package/dist/components/g-button.d.ts +11 -0
- package/dist/components/g-button.js +1 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/g-button.entry.js +2 -0
- package/dist/esm/g-ui.js +21 -0
- package/dist/esm/index-BVAZCj8P.js +1574 -0
- package/dist/esm/index.js +92 -0
- package/dist/esm/loader.js +11 -0
- package/dist/g-ui/g-ui.esm.js +1 -0
- package/dist/g-ui/index.esm.js +1 -0
- package/dist/g-ui/p-BVAZCj8P.js +2 -0
- package/dist/g-ui/p-DQuL1Twl.js +1 -0
- package/dist/g-ui/p-a0f43132.entry.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/my-button/my-button.d.ts +32 -0
- package/dist/types/components.d.ts +205 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/stencil-public-runtime.d.ts +1861 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +38 -0
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export class MyButton {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.type = 'primary';
|
|
5
|
+
this.size = 'md';
|
|
6
|
+
this.plain = false;
|
|
7
|
+
this.text = false;
|
|
8
|
+
this.bg = false;
|
|
9
|
+
this.link = false;
|
|
10
|
+
this.round = false;
|
|
11
|
+
this.circle = false;
|
|
12
|
+
this.dashed = false;
|
|
13
|
+
this.loading = false;
|
|
14
|
+
this.loadingIcon = '●';
|
|
15
|
+
this.disabled = false;
|
|
16
|
+
this.autofocus = false;
|
|
17
|
+
this.nativeType = 'button';
|
|
18
|
+
this.autoInsertSpace = false;
|
|
19
|
+
this.dark = false;
|
|
20
|
+
this.tag = 'button';
|
|
21
|
+
this.shouldAddSpace = false;
|
|
22
|
+
this.handleClick = (e) => {
|
|
23
|
+
if (this.loading || this.disabled) {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
e.stopPropagation();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
checkAutoSpace() {
|
|
30
|
+
if (!this.autoInsertSpace || !this.label) {
|
|
31
|
+
this.shouldAddSpace = false;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
this.shouldAddSpace =
|
|
35
|
+
this.label.length === 2 &&
|
|
36
|
+
/^[\u4e00-\u9fa5]+$/.test(this.label);
|
|
37
|
+
}
|
|
38
|
+
componentWillLoad() {
|
|
39
|
+
this.checkAutoSpace();
|
|
40
|
+
}
|
|
41
|
+
get computedClass() {
|
|
42
|
+
const { type, size, plain, text, bg, link, round, circle, dashed, loading, disabled, dark } = this;
|
|
43
|
+
const classes = ['btn', `btn--${type}`, `btn--${size}`];
|
|
44
|
+
if (plain)
|
|
45
|
+
classes.push('btn--plain');
|
|
46
|
+
if (text)
|
|
47
|
+
classes.push('btn--text');
|
|
48
|
+
if (bg)
|
|
49
|
+
classes.push('btn--bg');
|
|
50
|
+
if (link)
|
|
51
|
+
classes.push('btn--link');
|
|
52
|
+
if (round)
|
|
53
|
+
classes.push('btn--round');
|
|
54
|
+
if (circle)
|
|
55
|
+
classes.push('btn--circle');
|
|
56
|
+
if (dashed)
|
|
57
|
+
classes.push('btn--dashed');
|
|
58
|
+
if (loading)
|
|
59
|
+
classes.push('btn--loading');
|
|
60
|
+
if (disabled)
|
|
61
|
+
classes.push('btn--disabled');
|
|
62
|
+
if (dark)
|
|
63
|
+
classes.push('btn--dark');
|
|
64
|
+
return classes.join(' ');
|
|
65
|
+
}
|
|
66
|
+
get customStyle() {
|
|
67
|
+
if (!this.color)
|
|
68
|
+
return {};
|
|
69
|
+
return { '--g-btn-color': this.color };
|
|
70
|
+
}
|
|
71
|
+
render() {
|
|
72
|
+
const { loading, disabled, autofocus, nativeType, icon, label, tag: Tag, loadingIcon, shouldAddSpace, } = this;
|
|
73
|
+
const displayLabel = shouldAddSpace ? label.split('').join('\u2009') : label;
|
|
74
|
+
const content = (h(h.Fragment, null, loading && h("span", { key: '46a08c10ad7cadc4952dcb771c4dd1a244f7f156', class: "btn__loading-icon" }, loadingIcon), !loading && icon && h("span", { key: 'afc8df2cb5f8a21d6bdbe19cea1d809f388b64b1', class: "btn__icon" }, icon), displayLabel && h("span", { key: '8d52ddc448732cfbd94aaef3953a6c491ea8f173', class: "btn__label" }, displayLabel), h("slot", { key: 'c7e6e16593967cb08580c6c7fd7aa3728d6f921b' })));
|
|
75
|
+
return (h(Tag, { key: '734ed9490a23e332e0628809df532aed1035e2c5', class: this.computedClass, disabled: Tag === 'button' ? (disabled || loading) : undefined, type: Tag === 'button' ? nativeType : undefined, autofocus: Tag === 'button' ? autofocus : undefined, style: this.customStyle, onClick: this.handleClick }, content));
|
|
76
|
+
}
|
|
77
|
+
static get is() { return "g-button"; }
|
|
78
|
+
static get encapsulation() { return "shadow"; }
|
|
79
|
+
static get originalStyleUrls() {
|
|
80
|
+
return {
|
|
81
|
+
"$": ["my-button.css"]
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
static get styleUrls() {
|
|
85
|
+
return {
|
|
86
|
+
"$": ["my-button.css"]
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
static get properties() {
|
|
90
|
+
return {
|
|
91
|
+
"type": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"mutable": false,
|
|
94
|
+
"complexType": {
|
|
95
|
+
"original": "ButtonType",
|
|
96
|
+
"resolved": "\"danger\" | \"info\" | \"primary\" | \"secondary\" | \"success\" | \"warning\"",
|
|
97
|
+
"references": {
|
|
98
|
+
"ButtonType": {
|
|
99
|
+
"location": "local",
|
|
100
|
+
"path": "C:/Users/g/Desktop/app-demo/g-ui/packages/ui/src/components/my-button/my-button.tsx",
|
|
101
|
+
"id": "src/components/my-button/my-button.tsx::ButtonType"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"required": false,
|
|
106
|
+
"optional": false,
|
|
107
|
+
"docs": {
|
|
108
|
+
"tags": [],
|
|
109
|
+
"text": ""
|
|
110
|
+
},
|
|
111
|
+
"getter": false,
|
|
112
|
+
"setter": false,
|
|
113
|
+
"reflect": false,
|
|
114
|
+
"attribute": "type",
|
|
115
|
+
"defaultValue": "'primary'"
|
|
116
|
+
},
|
|
117
|
+
"size": {
|
|
118
|
+
"type": "string",
|
|
119
|
+
"mutable": false,
|
|
120
|
+
"complexType": {
|
|
121
|
+
"original": "ButtonSize",
|
|
122
|
+
"resolved": "\"lg\" | \"md\" | \"sm\"",
|
|
123
|
+
"references": {
|
|
124
|
+
"ButtonSize": {
|
|
125
|
+
"location": "local",
|
|
126
|
+
"path": "C:/Users/g/Desktop/app-demo/g-ui/packages/ui/src/components/my-button/my-button.tsx",
|
|
127
|
+
"id": "src/components/my-button/my-button.tsx::ButtonSize"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"required": false,
|
|
132
|
+
"optional": false,
|
|
133
|
+
"docs": {
|
|
134
|
+
"tags": [],
|
|
135
|
+
"text": ""
|
|
136
|
+
},
|
|
137
|
+
"getter": false,
|
|
138
|
+
"setter": false,
|
|
139
|
+
"reflect": false,
|
|
140
|
+
"attribute": "size",
|
|
141
|
+
"defaultValue": "'md'"
|
|
142
|
+
},
|
|
143
|
+
"plain": {
|
|
144
|
+
"type": "boolean",
|
|
145
|
+
"mutable": false,
|
|
146
|
+
"complexType": {
|
|
147
|
+
"original": "boolean",
|
|
148
|
+
"resolved": "boolean",
|
|
149
|
+
"references": {}
|
|
150
|
+
},
|
|
151
|
+
"required": false,
|
|
152
|
+
"optional": false,
|
|
153
|
+
"docs": {
|
|
154
|
+
"tags": [],
|
|
155
|
+
"text": ""
|
|
156
|
+
},
|
|
157
|
+
"getter": false,
|
|
158
|
+
"setter": false,
|
|
159
|
+
"reflect": false,
|
|
160
|
+
"attribute": "plain",
|
|
161
|
+
"defaultValue": "false"
|
|
162
|
+
},
|
|
163
|
+
"text": {
|
|
164
|
+
"type": "boolean",
|
|
165
|
+
"mutable": false,
|
|
166
|
+
"complexType": {
|
|
167
|
+
"original": "boolean",
|
|
168
|
+
"resolved": "boolean",
|
|
169
|
+
"references": {}
|
|
170
|
+
},
|
|
171
|
+
"required": false,
|
|
172
|
+
"optional": false,
|
|
173
|
+
"docs": {
|
|
174
|
+
"tags": [],
|
|
175
|
+
"text": ""
|
|
176
|
+
},
|
|
177
|
+
"getter": false,
|
|
178
|
+
"setter": false,
|
|
179
|
+
"reflect": false,
|
|
180
|
+
"attribute": "text",
|
|
181
|
+
"defaultValue": "false"
|
|
182
|
+
},
|
|
183
|
+
"bg": {
|
|
184
|
+
"type": "boolean",
|
|
185
|
+
"mutable": false,
|
|
186
|
+
"complexType": {
|
|
187
|
+
"original": "boolean",
|
|
188
|
+
"resolved": "boolean",
|
|
189
|
+
"references": {}
|
|
190
|
+
},
|
|
191
|
+
"required": false,
|
|
192
|
+
"optional": false,
|
|
193
|
+
"docs": {
|
|
194
|
+
"tags": [],
|
|
195
|
+
"text": ""
|
|
196
|
+
},
|
|
197
|
+
"getter": false,
|
|
198
|
+
"setter": false,
|
|
199
|
+
"reflect": false,
|
|
200
|
+
"attribute": "bg",
|
|
201
|
+
"defaultValue": "false"
|
|
202
|
+
},
|
|
203
|
+
"link": {
|
|
204
|
+
"type": "boolean",
|
|
205
|
+
"mutable": false,
|
|
206
|
+
"complexType": {
|
|
207
|
+
"original": "boolean",
|
|
208
|
+
"resolved": "boolean",
|
|
209
|
+
"references": {}
|
|
210
|
+
},
|
|
211
|
+
"required": false,
|
|
212
|
+
"optional": false,
|
|
213
|
+
"docs": {
|
|
214
|
+
"tags": [],
|
|
215
|
+
"text": ""
|
|
216
|
+
},
|
|
217
|
+
"getter": false,
|
|
218
|
+
"setter": false,
|
|
219
|
+
"reflect": false,
|
|
220
|
+
"attribute": "link",
|
|
221
|
+
"defaultValue": "false"
|
|
222
|
+
},
|
|
223
|
+
"round": {
|
|
224
|
+
"type": "boolean",
|
|
225
|
+
"mutable": false,
|
|
226
|
+
"complexType": {
|
|
227
|
+
"original": "boolean",
|
|
228
|
+
"resolved": "boolean",
|
|
229
|
+
"references": {}
|
|
230
|
+
},
|
|
231
|
+
"required": false,
|
|
232
|
+
"optional": false,
|
|
233
|
+
"docs": {
|
|
234
|
+
"tags": [],
|
|
235
|
+
"text": ""
|
|
236
|
+
},
|
|
237
|
+
"getter": false,
|
|
238
|
+
"setter": false,
|
|
239
|
+
"reflect": false,
|
|
240
|
+
"attribute": "round",
|
|
241
|
+
"defaultValue": "false"
|
|
242
|
+
},
|
|
243
|
+
"circle": {
|
|
244
|
+
"type": "boolean",
|
|
245
|
+
"mutable": false,
|
|
246
|
+
"complexType": {
|
|
247
|
+
"original": "boolean",
|
|
248
|
+
"resolved": "boolean",
|
|
249
|
+
"references": {}
|
|
250
|
+
},
|
|
251
|
+
"required": false,
|
|
252
|
+
"optional": false,
|
|
253
|
+
"docs": {
|
|
254
|
+
"tags": [],
|
|
255
|
+
"text": ""
|
|
256
|
+
},
|
|
257
|
+
"getter": false,
|
|
258
|
+
"setter": false,
|
|
259
|
+
"reflect": false,
|
|
260
|
+
"attribute": "circle",
|
|
261
|
+
"defaultValue": "false"
|
|
262
|
+
},
|
|
263
|
+
"dashed": {
|
|
264
|
+
"type": "boolean",
|
|
265
|
+
"mutable": false,
|
|
266
|
+
"complexType": {
|
|
267
|
+
"original": "boolean",
|
|
268
|
+
"resolved": "boolean",
|
|
269
|
+
"references": {}
|
|
270
|
+
},
|
|
271
|
+
"required": false,
|
|
272
|
+
"optional": false,
|
|
273
|
+
"docs": {
|
|
274
|
+
"tags": [],
|
|
275
|
+
"text": ""
|
|
276
|
+
},
|
|
277
|
+
"getter": false,
|
|
278
|
+
"setter": false,
|
|
279
|
+
"reflect": false,
|
|
280
|
+
"attribute": "dashed",
|
|
281
|
+
"defaultValue": "false"
|
|
282
|
+
},
|
|
283
|
+
"loading": {
|
|
284
|
+
"type": "boolean",
|
|
285
|
+
"mutable": false,
|
|
286
|
+
"complexType": {
|
|
287
|
+
"original": "boolean",
|
|
288
|
+
"resolved": "boolean",
|
|
289
|
+
"references": {}
|
|
290
|
+
},
|
|
291
|
+
"required": false,
|
|
292
|
+
"optional": false,
|
|
293
|
+
"docs": {
|
|
294
|
+
"tags": [],
|
|
295
|
+
"text": ""
|
|
296
|
+
},
|
|
297
|
+
"getter": false,
|
|
298
|
+
"setter": false,
|
|
299
|
+
"reflect": false,
|
|
300
|
+
"attribute": "loading",
|
|
301
|
+
"defaultValue": "false"
|
|
302
|
+
},
|
|
303
|
+
"loadingIcon": {
|
|
304
|
+
"type": "string",
|
|
305
|
+
"mutable": false,
|
|
306
|
+
"complexType": {
|
|
307
|
+
"original": "string",
|
|
308
|
+
"resolved": "string",
|
|
309
|
+
"references": {}
|
|
310
|
+
},
|
|
311
|
+
"required": false,
|
|
312
|
+
"optional": false,
|
|
313
|
+
"docs": {
|
|
314
|
+
"tags": [],
|
|
315
|
+
"text": ""
|
|
316
|
+
},
|
|
317
|
+
"getter": false,
|
|
318
|
+
"setter": false,
|
|
319
|
+
"reflect": false,
|
|
320
|
+
"attribute": "loading-icon",
|
|
321
|
+
"defaultValue": "'\u25CF'"
|
|
322
|
+
},
|
|
323
|
+
"disabled": {
|
|
324
|
+
"type": "boolean",
|
|
325
|
+
"mutable": false,
|
|
326
|
+
"complexType": {
|
|
327
|
+
"original": "boolean",
|
|
328
|
+
"resolved": "boolean",
|
|
329
|
+
"references": {}
|
|
330
|
+
},
|
|
331
|
+
"required": false,
|
|
332
|
+
"optional": false,
|
|
333
|
+
"docs": {
|
|
334
|
+
"tags": [],
|
|
335
|
+
"text": ""
|
|
336
|
+
},
|
|
337
|
+
"getter": false,
|
|
338
|
+
"setter": false,
|
|
339
|
+
"reflect": false,
|
|
340
|
+
"attribute": "disabled",
|
|
341
|
+
"defaultValue": "false"
|
|
342
|
+
},
|
|
343
|
+
"icon": {
|
|
344
|
+
"type": "string",
|
|
345
|
+
"mutable": false,
|
|
346
|
+
"complexType": {
|
|
347
|
+
"original": "string",
|
|
348
|
+
"resolved": "string | undefined",
|
|
349
|
+
"references": {}
|
|
350
|
+
},
|
|
351
|
+
"required": false,
|
|
352
|
+
"optional": true,
|
|
353
|
+
"docs": {
|
|
354
|
+
"tags": [],
|
|
355
|
+
"text": ""
|
|
356
|
+
},
|
|
357
|
+
"getter": false,
|
|
358
|
+
"setter": false,
|
|
359
|
+
"reflect": false,
|
|
360
|
+
"attribute": "icon"
|
|
361
|
+
},
|
|
362
|
+
"autofocus": {
|
|
363
|
+
"type": "boolean",
|
|
364
|
+
"mutable": false,
|
|
365
|
+
"complexType": {
|
|
366
|
+
"original": "boolean",
|
|
367
|
+
"resolved": "boolean",
|
|
368
|
+
"references": {}
|
|
369
|
+
},
|
|
370
|
+
"required": false,
|
|
371
|
+
"optional": false,
|
|
372
|
+
"docs": {
|
|
373
|
+
"tags": [],
|
|
374
|
+
"text": ""
|
|
375
|
+
},
|
|
376
|
+
"getter": false,
|
|
377
|
+
"setter": false,
|
|
378
|
+
"reflect": false,
|
|
379
|
+
"attribute": "autofocus",
|
|
380
|
+
"defaultValue": "false"
|
|
381
|
+
},
|
|
382
|
+
"nativeType": {
|
|
383
|
+
"type": "string",
|
|
384
|
+
"mutable": false,
|
|
385
|
+
"complexType": {
|
|
386
|
+
"original": "NativeButtonType",
|
|
387
|
+
"resolved": "\"button\" | \"reset\" | \"submit\"",
|
|
388
|
+
"references": {
|
|
389
|
+
"NativeButtonType": {
|
|
390
|
+
"location": "local",
|
|
391
|
+
"path": "C:/Users/g/Desktop/app-demo/g-ui/packages/ui/src/components/my-button/my-button.tsx",
|
|
392
|
+
"id": "src/components/my-button/my-button.tsx::NativeButtonType"
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
"required": false,
|
|
397
|
+
"optional": false,
|
|
398
|
+
"docs": {
|
|
399
|
+
"tags": [],
|
|
400
|
+
"text": ""
|
|
401
|
+
},
|
|
402
|
+
"getter": false,
|
|
403
|
+
"setter": false,
|
|
404
|
+
"reflect": false,
|
|
405
|
+
"attribute": "native-type",
|
|
406
|
+
"defaultValue": "'button'"
|
|
407
|
+
},
|
|
408
|
+
"autoInsertSpace": {
|
|
409
|
+
"type": "boolean",
|
|
410
|
+
"mutable": false,
|
|
411
|
+
"complexType": {
|
|
412
|
+
"original": "boolean",
|
|
413
|
+
"resolved": "boolean",
|
|
414
|
+
"references": {}
|
|
415
|
+
},
|
|
416
|
+
"required": false,
|
|
417
|
+
"optional": false,
|
|
418
|
+
"docs": {
|
|
419
|
+
"tags": [],
|
|
420
|
+
"text": ""
|
|
421
|
+
},
|
|
422
|
+
"getter": false,
|
|
423
|
+
"setter": false,
|
|
424
|
+
"reflect": false,
|
|
425
|
+
"attribute": "auto-insert-space",
|
|
426
|
+
"defaultValue": "false"
|
|
427
|
+
},
|
|
428
|
+
"color": {
|
|
429
|
+
"type": "string",
|
|
430
|
+
"mutable": false,
|
|
431
|
+
"complexType": {
|
|
432
|
+
"original": "string",
|
|
433
|
+
"resolved": "string | undefined",
|
|
434
|
+
"references": {}
|
|
435
|
+
},
|
|
436
|
+
"required": false,
|
|
437
|
+
"optional": true,
|
|
438
|
+
"docs": {
|
|
439
|
+
"tags": [],
|
|
440
|
+
"text": ""
|
|
441
|
+
},
|
|
442
|
+
"getter": false,
|
|
443
|
+
"setter": false,
|
|
444
|
+
"reflect": false,
|
|
445
|
+
"attribute": "color"
|
|
446
|
+
},
|
|
447
|
+
"dark": {
|
|
448
|
+
"type": "boolean",
|
|
449
|
+
"mutable": false,
|
|
450
|
+
"complexType": {
|
|
451
|
+
"original": "boolean",
|
|
452
|
+
"resolved": "boolean",
|
|
453
|
+
"references": {}
|
|
454
|
+
},
|
|
455
|
+
"required": false,
|
|
456
|
+
"optional": false,
|
|
457
|
+
"docs": {
|
|
458
|
+
"tags": [],
|
|
459
|
+
"text": ""
|
|
460
|
+
},
|
|
461
|
+
"getter": false,
|
|
462
|
+
"setter": false,
|
|
463
|
+
"reflect": false,
|
|
464
|
+
"attribute": "dark",
|
|
465
|
+
"defaultValue": "false"
|
|
466
|
+
},
|
|
467
|
+
"tag": {
|
|
468
|
+
"type": "string",
|
|
469
|
+
"mutable": false,
|
|
470
|
+
"complexType": {
|
|
471
|
+
"original": "string",
|
|
472
|
+
"resolved": "string",
|
|
473
|
+
"references": {}
|
|
474
|
+
},
|
|
475
|
+
"required": false,
|
|
476
|
+
"optional": false,
|
|
477
|
+
"docs": {
|
|
478
|
+
"tags": [],
|
|
479
|
+
"text": ""
|
|
480
|
+
},
|
|
481
|
+
"getter": false,
|
|
482
|
+
"setter": false,
|
|
483
|
+
"reflect": false,
|
|
484
|
+
"attribute": "tag",
|
|
485
|
+
"defaultValue": "'button'"
|
|
486
|
+
},
|
|
487
|
+
"label": {
|
|
488
|
+
"type": "string",
|
|
489
|
+
"mutable": false,
|
|
490
|
+
"complexType": {
|
|
491
|
+
"original": "string",
|
|
492
|
+
"resolved": "string | undefined",
|
|
493
|
+
"references": {}
|
|
494
|
+
},
|
|
495
|
+
"required": false,
|
|
496
|
+
"optional": true,
|
|
497
|
+
"docs": {
|
|
498
|
+
"tags": [],
|
|
499
|
+
"text": ""
|
|
500
|
+
},
|
|
501
|
+
"getter": false,
|
|
502
|
+
"setter": false,
|
|
503
|
+
"reflect": false,
|
|
504
|
+
"attribute": "label"
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
static get states() {
|
|
509
|
+
return {
|
|
510
|
+
"shouldAddSpace": {}
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
static get watchers() {
|
|
514
|
+
return [{
|
|
515
|
+
"propName": "label",
|
|
516
|
+
"methodName": "checkAutoSpace"
|
|
517
|
+
}, {
|
|
518
|
+
"propName": "autoInsertSpace",
|
|
519
|
+
"methodName": "checkAutoSpace"
|
|
520
|
+
}];
|
|
521
|
+
}
|
|
522
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MyButton } from './components/my-button/my-button';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface GButton extends Components.GButton, HTMLElement {}
|
|
4
|
+
export const GButton: {
|
|
5
|
+
prototype: GButton;
|
|
6
|
+
new (): GButton;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MyButton as o,d as r}from"./index.js";const s=o,t=r;export{s as GButton,t as defineCustomElement}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the base path to where the assets can be found. Use "setAssetPath(path)"
|
|
3
|
+
* if the path needs to be customized.
|
|
4
|
+
*/
|
|
5
|
+
export declare const getAssetPath: (path: string) => string;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Used to manually set the base path where assets can be found.
|
|
9
|
+
* If the script is used as "module", it's recommended to use "import.meta.url",
|
|
10
|
+
* such as "setAssetPath(import.meta.url)". Other options include
|
|
11
|
+
* "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
|
|
12
|
+
* dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
|
|
13
|
+
* But do note that this configuration depends on how your script is bundled, or lack of
|
|
14
|
+
* bundling, and where your assets can be loaded from. Additionally custom bundling
|
|
15
|
+
* will have to ensure the static assets are copied to its build directory.
|
|
16
|
+
*/
|
|
17
|
+
export declare const setAssetPath: (path: string) => void;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Used to specify a nonce value that corresponds with an application's CSP.
|
|
21
|
+
* When set, the nonce will be added to all dynamically created script and style tags at runtime.
|
|
22
|
+
* Alternatively, the nonce value can be set on a meta tag in the DOM head
|
|
23
|
+
* (<meta name="csp-nonce" content="{ nonce value here }" />) which
|
|
24
|
+
* will result in the same behavior.
|
|
25
|
+
*/
|
|
26
|
+
export declare const setNonce: (nonce: string) => void
|
|
27
|
+
|
|
28
|
+
export interface SetPlatformOptions {
|
|
29
|
+
raf?: (c: FrameRequestCallback) => number;
|
|
30
|
+
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
31
|
+
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
32
|
+
}
|
|
33
|
+
export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
|
|
34
|
+
|
|
35
|
+
export * from '../types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{transformTag as t,proxyCustomElement as o,HTMLElement as n,h as r}from"@stencil/core/internal/client";export{getAssetPath,render,setAssetPath,setNonce,setPlatformOptions}from"@stencil/core/internal/client";const e=o(class extends n{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.type="primary",this.size="md",this.plain=!1,this.text=!1,this.bg=!1,this.link=!1,this.round=!1,this.circle=!1,this.dashed=!1,this.loading=!1,this.loadingIcon="●",this.disabled=!1,this.autofocus=!1,this.nativeType="button",this.autoInsertSpace=!1,this.dark=!1,this.tag="button",this.shouldAddSpace=!1,this.handleClick=t=>{(this.loading||this.disabled)&&(t.preventDefault(),t.stopPropagation())}}checkAutoSpace(){this.shouldAddSpace=!(!this.autoInsertSpace||!this.label)&&2===this.label.length&&/^[\u4e00-\u9fa5]+$/.test(this.label)}componentWillLoad(){this.checkAutoSpace()}get computedClass(){const{type:t,size:o,plain:n,text:r,bg:e,link:a,round:c,circle:l,dashed:b,loading:i,disabled:s,dark:d}=this,g=["btn","btn--"+t,"btn--"+o];return n&&g.push("btn--plain"),r&&g.push("btn--text"),e&&g.push("btn--bg"),a&&g.push("btn--link"),c&&g.push("btn--round"),l&&g.push("btn--circle"),b&&g.push("btn--dashed"),i&&g.push("btn--loading"),s&&g.push("btn--disabled"),d&&g.push("btn--dark"),g.join(" ")}get customStyle(){return this.color?{"--g-btn-color":this.color}:{}}render(){const{loading:t,disabled:o,autofocus:n,nativeType:e,icon:a,label:c,tag:l,loadingIcon:b,shouldAddSpace:i}=this,s=i?c.split("").join(" "):c,d=r(r.Fragment,null,t&&r("span",{key:"46a08c10ad7cadc4952dcb771c4dd1a244f7f156",class:"btn__loading-icon"},b),!t&&a&&r("span",{key:"afc8df2cb5f8a21d6bdbe19cea1d809f388b64b1",class:"btn__icon"},a),s&&r("span",{key:"8d52ddc448732cfbd94aaef3953a6c491ea8f173",class:"btn__label"},s),r("slot",{key:"c7e6e16593967cb08580c6c7fd7aa3728d6f921b"}));return r(l,{key:"734ed9490a23e332e0628809df532aed1035e2c5",class:this.computedClass,disabled:"button"===l?o||t:void 0,type:"button"===l?e:void 0,autofocus:"button"===l?n:void 0,style:this.customStyle,onClick:this.handleClick},d)}static get watchers(){return{label:[{checkAutoSpace:0}],autoInsertSpace:[{checkAutoSpace:0}]}}static get style(){return":host{display:inline-block}:host(:not(:first-child)){margin-left:12px}:host{--g-btn-color:#4f46e5;--g-btn-color-hover:#4338ca;--g-btn-color-active:#3730a3;--g-btn-text-color:#fff;--g-btn-plain-bg:#eef2ff}.btn{display:inline-flex;align-items:center;justify-content:center;gap:0.25em;border:1px solid var(--g-btn-color);border-radius:6px;font-family:inherit;font-weight:600;line-height:1;cursor:pointer;user-select:none;transition:all 0.2s ease;background-color:var(--g-btn-color);color:var(--g-btn-text-color);vertical-align:middle;text-decoration:none;white-space:nowrap}.btn:hover{background-color:var(--g-btn-color-hover);border-color:var(--g-btn-color-hover)}.btn:active{background-color:var(--g-btn-color-active);border-color:var(--g-btn-color-active)}.btn:disabled,.btn--disabled{opacity:0.5;cursor:not-allowed;pointer-events:none}.btn--sm{padding:0.375rem 0.75rem;font-size:0.875rem}.btn--md{padding:0.5rem 1rem;font-size:1rem}.btn--lg{padding:0.75rem 1.5rem;font-size:1.125rem}.btn--primary{--g-btn-color:#4f46e5;--g-btn-color-hover:#4338ca;--g-btn-color-active:#3730a3;--g-btn-plain-bg:#eef2ff}.btn--success{--g-btn-color:#10b981;--g-btn-color-hover:#059669;--g-btn-color-active:#047857;--g-btn-plain-bg:#d1fae5}.btn--warning{--g-btn-color:#f59e0b;--g-btn-color-hover:#d97706;--g-btn-color-active:#b45309;--g-btn-plain-bg:#fef3c7}.btn--danger{--g-btn-color:#ef4444;--g-btn-color-hover:#dc2626;--g-btn-color-active:#b91c1c;--g-btn-plain-bg:#fee2e2}.btn--info,.btn--secondary{--g-btn-color:#6b7280;--g-btn-color-hover:#4b5563;--g-btn-color-active:#374151;--g-btn-plain-bg:#f3f4f6}.btn--plain{background-color:transparent;color:var(--g-btn-color)}.btn--plain:hover{background-color:var(--g-btn-plain-bg);color:var(--g-btn-color-hover);border-color:var(--g-btn-color-hover)}.btn--plain:active{background-color:var(--g-btn-plain-bg);color:var(--g-btn-color-active);border-color:var(--g-btn-color-active)}.btn--text{border-color:transparent;background-color:transparent;color:var(--g-btn-color)}.btn--text:hover{background-color:transparent;color:var(--g-btn-color-hover);border-color:transparent}.btn--text:active{color:var(--g-btn-color-active)}.btn--text.btn--bg:hover{background-color:var(--g-btn-plain-bg)}.btn--link{border-color:transparent;background-color:transparent;color:var(--g-btn-color);padding:0;font-weight:400}.btn--link:hover{background-color:transparent;color:var(--g-btn-color-hover);border-color:transparent;text-decoration:underline}.btn--link:active{color:var(--g-btn-color-active)}.btn--round{border-radius:9999px}.btn--circle{border-radius:50%;padding:0.5rem;width:2.5rem;height:2.5rem}.btn--circle.btn--sm{width:2rem;height:2rem;padding:0.375rem}.btn--circle.btn--lg{width:3rem;height:3rem;padding:0.75rem}.btn--dashed{border-style:dashed;background-color:color-mix(in srgb, var(--g-btn-color) 10%, transparent)}.btn--dashed:hover{background-color:color-mix(in srgb, var(--g-btn-color) 20%, transparent)}.btn--loading{cursor:wait;opacity:0.8}.btn__loading-icon{display:inline-flex;animation:g-spin 1s linear infinite}@keyframes g-spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}.btn__icon{display:inline-flex;font-size:1.1em}.btn__label{display:inline-flex;align-items:center}.btn--dark{--g-btn-color:#818cf8;--g-btn-color-hover:#6366f1;--g-btn-color-active:#4f46e5;--g-btn-plain-bg:#1e1b4b;--g-btn-text-color:#0f0f0f}.btn--dark.btn--plain{background-color:transparent;color:var(--g-btn-color);border-color:var(--g-btn-color)}.btn--dark.btn--text,.btn--dark.btn--link{color:var(--g-btn-color)}:host([style*='--g-btn-color']) .btn{background-color:var(--g-btn-color);border-color:var(--g-btn-color);color:var(--g-btn-text-color, #fff)}:host([style*='--g-btn-color']) .btn.btn--plain{background-color:transparent;color:var(--g-btn-color)}:host([style*='--g-btn-color']) .btn.btn--text,:host([style*='--g-btn-color']) .btn.btn--link{background-color:transparent;border-color:transparent;color:var(--g-btn-color)}"}},[257,"g-button",{type:[1],size:[1],plain:[4],text:[4],bg:[4],link:[4],round:[4],circle:[4],dashed:[4],loading:[4],loadingIcon:[1,"loading-icon"],disabled:[4],icon:[1],autofocus:[4],nativeType:[1,"native-type"],autoInsertSpace:[4,"auto-insert-space"],color:[1],dark:[4],tag:[1],label:[1],shouldAddSpace:[32]},void 0,{label:[{checkAutoSpace:0}],autoInsertSpace:[{checkAutoSpace:0}]}]);function a(){"undefined"!=typeof customElements&&["g-button"].forEach((o=>{"g-button"===o&&(customElements.get(t(o))||customElements.define(t(o),e))}))}a();export{e as MyButton,a as d}
|
package/dist/esm/g-ui.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-BVAZCj8P.js';
|
|
2
|
+
export { s as setNonce } from './index-BVAZCj8P.js';
|
|
3
|
+
import { g as globalScripts } from './app-globals-DQuL1Twl.js';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
Stencil Client Patch Browser v4.43.5 | MIT Licensed | https://stenciljs.com
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
var patchBrowser = () => {
|
|
10
|
+
const importMeta = import.meta.url;
|
|
11
|
+
const opts = {};
|
|
12
|
+
if (importMeta !== "") {
|
|
13
|
+
opts.resourcesUrl = new URL(".", importMeta).href;
|
|
14
|
+
}
|
|
15
|
+
return promiseResolve(opts);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
patchBrowser().then(async (options) => {
|
|
19
|
+
await globalScripts();
|
|
20
|
+
return bootstrapLazy([["g-button",[[257,"g-button",{"type":[1],"size":[1],"plain":[4],"text":[4],"bg":[4],"link":[4],"round":[4],"circle":[4],"dashed":[4],"loading":[4],"loadingIcon":[1,"loading-icon"],"disabled":[4],"icon":[1],"autofocus":[4],"nativeType":[1,"native-type"],"autoInsertSpace":[4,"auto-insert-space"],"color":[1],"dark":[4],"tag":[1],"label":[1],"shouldAddSpace":[32]},null,{"label":[{"checkAutoSpace":0}],"autoInsertSpace":[{"checkAutoSpace":0}]}]]]], options);
|
|
21
|
+
});
|