@parksw/sw-ui-components 0.0.2 → 0.0.3

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.
@@ -0,0 +1,7 @@
1
+ function __decorate(e, t, n, r) {
2
+ var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
3
+ if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
4
+ else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
5
+ return i > 3 && a && Object.defineProperty(t, n, a), a;
6
+ }
7
+ export { __decorate as t };
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
- export * from './my-element.js';
2
- export * from './my-button.js';
3
- export * from './my-calendar.js';
4
- export * from './my-grid.js';
1
+ import "./decorate-BnP3GfGh.js";
2
+ import { t as MyElement } from "./my-element-BWehTtOJ.js";
3
+ import { t as MyButton } from "./my-button-BXW2ABd3.js";
4
+ import { t as MyCalendar } from "./my-calendar-ylD4tbTZ.js";
5
+ import { t as MyGrid } from "./my-grid-DduCSbuo.js";
6
+ export { MyButton, MyCalendar, MyElement, MyGrid };
@@ -0,0 +1,59 @@
1
+ import { t as __decorate } from "./decorate-BnP3GfGh.js";
2
+ import { LitElement, css, html } from "lit";
3
+ import { customElement, property } from "lit/decorators.js";
4
+ var MyButton = class extends LitElement {
5
+ constructor(...e) {
6
+ super(...e), this.label = "Button", this.disabled = !1, this.variant = "primary";
7
+ }
8
+ render() {
9
+ return html`
10
+ <button
11
+ class="button ${this.variant}"
12
+ ?disabled=${this.disabled}
13
+ >
14
+ ${this.label}
15
+ </button>
16
+ `;
17
+ }
18
+ static #e = this.styles = css`
19
+ .button {
20
+ border: none;
21
+ color: white;
22
+ padding: 12px 24px;
23
+ text-align: center;
24
+ text-decoration: none;
25
+ display: inline-block;
26
+ font-size: 16px;
27
+ margin: 4px 2px;
28
+ cursor: pointer;
29
+ border-radius: 8px;
30
+ transition: background-color 0.3s ease;
31
+ }
32
+
33
+ .button:disabled {
34
+ cursor: not-allowed;
35
+ opacity: 0.6;
36
+ }
37
+
38
+ .primary {
39
+ background-color: #4CAF50; /* Green */
40
+ }
41
+
42
+ .primary:hover:not(:disabled) {
43
+ background-color: #45a049;
44
+ }
45
+
46
+ .secondary {
47
+ background-color: #008CBA; /* Blue */
48
+ }
49
+
50
+ .secondary:hover:not(:disabled) {
51
+ background-color: #007bb5;
52
+ }
53
+ `;
54
+ };
55
+ __decorate([property({ type: String })], MyButton.prototype, "label", void 0), __decorate([property({
56
+ type: Boolean,
57
+ reflect: !0
58
+ })], MyButton.prototype, "disabled", void 0), __decorate([property({ type: String })], MyButton.prototype, "variant", void 0), MyButton = __decorate([customElement("my-button")], MyButton);
59
+ export { MyButton as t };
package/dist/my-button.js CHANGED
@@ -1,75 +1,3 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { LitElement, css, html } from 'lit';
8
- import { customElement, property } from 'lit/decorators.js';
9
- let MyButton = class MyButton extends LitElement {
10
- constructor() {
11
- super(...arguments);
12
- this.label = 'Button';
13
- this.disabled = false;
14
- this.variant = 'primary';
15
- }
16
- render() {
17
- return html `
18
- <button
19
- class="button ${this.variant}"
20
- ?disabled=${this.disabled}
21
- >
22
- ${this.label}
23
- </button>
24
- `;
25
- }
26
- static { this.styles = css `
27
- .button {
28
- border: none;
29
- color: white;
30
- padding: 12px 24px;
31
- text-align: center;
32
- text-decoration: none;
33
- display: inline-block;
34
- font-size: 16px;
35
- margin: 4px 2px;
36
- cursor: pointer;
37
- border-radius: 8px;
38
- transition: background-color 0.3s ease;
39
- }
40
-
41
- .button:disabled {
42
- cursor: not-allowed;
43
- opacity: 0.6;
44
- }
45
-
46
- .primary {
47
- background-color: #4CAF50; /* Green */
48
- }
49
-
50
- .primary:hover:not(:disabled) {
51
- background-color: #45a049;
52
- }
53
-
54
- .secondary {
55
- background-color: #008CBA; /* Blue */
56
- }
57
-
58
- .secondary:hover:not(:disabled) {
59
- background-color: #007bb5;
60
- }
61
- `; }
62
- };
63
- __decorate([
64
- property({ type: String })
65
- ], MyButton.prototype, "label", void 0);
66
- __decorate([
67
- property({ type: Boolean, reflect: true })
68
- ], MyButton.prototype, "disabled", void 0);
69
- __decorate([
70
- property({ type: String })
71
- ], MyButton.prototype, "variant", void 0);
72
- MyButton = __decorate([
73
- customElement('my-button')
74
- ], MyButton);
1
+ import "./decorate-BnP3GfGh.js";
2
+ import { t as MyButton } from "./my-button-BXW2ABd3.js";
75
3
  export { MyButton };
@@ -0,0 +1,135 @@
1
+ import { t as __decorate } from "./decorate-BnP3GfGh.js";
2
+ import { LitElement, css, html } from "lit";
3
+ import { customElement, state } from "lit/decorators.js";
4
+ var MyCalendar = class extends LitElement {
5
+ constructor(...e) {
6
+ super(...e), this.date = /* @__PURE__ */ new Date();
7
+ }
8
+ get year() {
9
+ return this.date.getFullYear();
10
+ }
11
+ get month() {
12
+ return this.date.getMonth();
13
+ }
14
+ _changeMonth(e) {
15
+ this.date = new Date(this.year, this.month + e, 1);
16
+ }
17
+ _renderHeader() {
18
+ return html`
19
+ <div class="header">
20
+ <button @click=${() => this._changeMonth(-1)}>‹</button>
21
+ <div class="month-year">${this.date.toLocaleString("default", { month: "long" })} ${this.year}</div>
22
+ <button @click=${() => this._changeMonth(1)}>›</button>
23
+ </div>
24
+ `;
25
+ }
26
+ _renderDaysOfWeek() {
27
+ return html`
28
+ <div class="days-of-week">
29
+ ${[
30
+ "Sun",
31
+ "Mon",
32
+ "Tue",
33
+ "Wed",
34
+ "Thu",
35
+ "Fri",
36
+ "Sat"
37
+ ].map((e) => html`<div>${e}</div>`)}
38
+ </div>
39
+ `;
40
+ }
41
+ _renderDates() {
42
+ let e = /* @__PURE__ */ new Date(), i = new Date(this.year, this.month, 1).getDay(), a = new Date(this.year, this.month + 1, 0).getDate(), o = [];
43
+ for (let e = 0; e < i; e++) o.push(html`<div class="date-cell empty"></div>`);
44
+ for (let i = 1; i <= a; i++) {
45
+ let a = this.year === e.getFullYear() && this.month === e.getMonth() && i === e.getDate();
46
+ o.push(html`<div class="date-cell ${a ? "today" : ""}">${i}</div>`);
47
+ }
48
+ return html`<div class="date-grid">${o}</div>`;
49
+ }
50
+ render() {
51
+ return html`
52
+ <div class="calendar-container">
53
+ ${this._renderHeader()}
54
+ ${this._renderDaysOfWeek()}
55
+ ${this._renderDates()}
56
+ </div>
57
+ `;
58
+ }
59
+ static #e = this.styles = css`
60
+ :host {
61
+ display: block;
62
+ max-width: 350px;
63
+ border: 1px solid #ccc;
64
+ border-radius: 8px;
65
+ padding: 16px;
66
+ font-family: sans-serif;
67
+ box-shadow: 0 4px 8px rgba(0,0,0,0.1);
68
+ }
69
+
70
+ .header {
71
+ display: flex;
72
+ justify-content: space-between;
73
+ align-items: center;
74
+ margin-bottom: 16px;
75
+ }
76
+
77
+ .header button {
78
+ background: none;
79
+ border: 1px solid #ccc;
80
+ border-radius: 50%;
81
+ width: 32px;
82
+ height: 32px;
83
+ cursor: pointer;
84
+ font-size: 18px;
85
+ transition: background-color 0.2s;
86
+ }
87
+
88
+ .header button:hover {
89
+ background-color: #eee;
90
+ }
91
+
92
+ .month-year {
93
+ font-size: 1.2em;
94
+ font-weight: bold;
95
+ }
96
+
97
+ .days-of-week, .date-grid {
98
+ display: grid;
99
+ grid-template-columns: repeat(7, 1fr);
100
+ text-align: center;
101
+ }
102
+
103
+ .days-of-week > div {
104
+ font-weight: bold;
105
+ padding-bottom: 8px;
106
+ font-size: 0.9em;
107
+ color: #666;
108
+ }
109
+
110
+ .date-cell {
111
+ padding: 4px 0;
112
+ cursor: pointer;
113
+ border-radius: 50%;
114
+ width: 32px;
115
+ height: 32px;
116
+ display: flex;
117
+ justify-content: center;
118
+ align-items: center;
119
+ margin: 2px auto;
120
+ transition: background-color 0.2s;
121
+ }
122
+
123
+ .date-cell:not(.empty):hover {
124
+ background-color: #eee;
125
+ }
126
+
127
+ .date-cell.today {
128
+ background-color: #4CAF50;
129
+ color: white;
130
+ font-weight: bold;
131
+ }
132
+ `;
133
+ };
134
+ __decorate([state()], MyCalendar.prototype, "date", void 0), MyCalendar = __decorate([customElement("my-calendar")], MyCalendar);
135
+ export { MyCalendar as t };
@@ -1,147 +1,3 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { LitElement, css, html } from 'lit';
8
- import { customElement, state } from 'lit/decorators.js';
9
- let MyCalendar = class MyCalendar extends LitElement {
10
- constructor() {
11
- super(...arguments);
12
- this.date = new Date();
13
- }
14
- get year() {
15
- return this.date.getFullYear();
16
- }
17
- get month() {
18
- return this.date.getMonth();
19
- }
20
- _changeMonth(offset) {
21
- this.date = new Date(this.year, this.month + offset, 1);
22
- }
23
- _renderHeader() {
24
- const monthName = this.date.toLocaleString('default', { month: 'long' });
25
- return html `
26
- <div class="header">
27
- <button @click=${() => this._changeMonth(-1)}>‹</button>
28
- <div class="month-year">${monthName} ${this.year}</div>
29
- <button @click=${() => this._changeMonth(1)}>›</button>
30
- </div>
31
- `;
32
- }
33
- _renderDaysOfWeek() {
34
- const days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
35
- return html `
36
- <div class="days-of-week">
37
- ${days.map(day => html `<div>${day}</div>`)}
38
- </div>
39
- `;
40
- }
41
- _renderDates() {
42
- const today = new Date();
43
- const firstDayOfMonth = new Date(this.year, this.month, 1).getDay();
44
- const daysInMonth = new Date(this.year, this.month + 1, 0).getDate();
45
- const dates = [];
46
- for (let i = 0; i < firstDayOfMonth; i++) {
47
- dates.push(html `<div class="date-cell empty"></div>`);
48
- }
49
- for (let i = 1; i <= daysInMonth; i++) {
50
- const isToday = this.year === today.getFullYear() &&
51
- this.month === today.getMonth() &&
52
- i === today.getDate();
53
- dates.push(html `<div class="date-cell ${isToday ? 'today' : ''}">${i}</div>`);
54
- }
55
- return html `<div class="date-grid">${dates}</div>`;
56
- }
57
- render() {
58
- return html `
59
- <div class="calendar-container">
60
- ${this._renderHeader()}
61
- ${this._renderDaysOfWeek()}
62
- ${this._renderDates()}
63
- </div>
64
- `;
65
- }
66
- static { this.styles = css `
67
- :host {
68
- display: block;
69
- max-width: 350px;
70
- border: 1px solid #ccc;
71
- border-radius: 8px;
72
- padding: 16px;
73
- font-family: sans-serif;
74
- box-shadow: 0 4px 8px rgba(0,0,0,0.1);
75
- }
76
-
77
- .header {
78
- display: flex;
79
- justify-content: space-between;
80
- align-items: center;
81
- margin-bottom: 16px;
82
- }
83
-
84
- .header button {
85
- background: none;
86
- border: 1px solid #ccc;
87
- border-radius: 50%;
88
- width: 32px;
89
- height: 32px;
90
- cursor: pointer;
91
- font-size: 18px;
92
- transition: background-color 0.2s;
93
- }
94
-
95
- .header button:hover {
96
- background-color: #eee;
97
- }
98
-
99
- .month-year {
100
- font-size: 1.2em;
101
- font-weight: bold;
102
- }
103
-
104
- .days-of-week, .date-grid {
105
- display: grid;
106
- grid-template-columns: repeat(7, 1fr);
107
- text-align: center;
108
- }
109
-
110
- .days-of-week > div {
111
- font-weight: bold;
112
- padding-bottom: 8px;
113
- font-size: 0.9em;
114
- color: #666;
115
- }
116
-
117
- .date-cell {
118
- padding: 4px 0;
119
- cursor: pointer;
120
- border-radius: 50%;
121
- width: 32px;
122
- height: 32px;
123
- display: flex;
124
- justify-content: center;
125
- align-items: center;
126
- margin: 2px auto;
127
- transition: background-color 0.2s;
128
- }
129
-
130
- .date-cell:not(.empty):hover {
131
- background-color: #eee;
132
- }
133
-
134
- .date-cell.today {
135
- background-color: #4CAF50;
136
- color: white;
137
- font-weight: bold;
138
- }
139
- `; }
140
- };
141
- __decorate([
142
- state()
143
- ], MyCalendar.prototype, "date", void 0);
144
- MyCalendar = __decorate([
145
- customElement('my-calendar')
146
- ], MyCalendar);
1
+ import "./decorate-BnP3GfGh.js";
2
+ import { t as MyCalendar } from "./my-calendar-ylD4tbTZ.js";
147
3
  export { MyCalendar };
@@ -0,0 +1,23 @@
1
+ import { t as __decorate } from "./decorate-BnP3GfGh.js";
2
+ import { LitElement, css, html } from "lit";
3
+ import { customElement, property } from "lit/decorators.js";
4
+ var MyElement = class extends LitElement {
5
+ constructor(...e) {
6
+ super(...e), this.name = "World";
7
+ }
8
+ render() {
9
+ return html`
10
+ <h1>Hello, ${this.name}!</h1>
11
+ `;
12
+ }
13
+ static #e = this.styles = css`
14
+ :host {
15
+ display: block;
16
+ border: solid 1px gray;
17
+ padding: 16px;
18
+ max-width: 800px;
19
+ }
20
+ `;
21
+ };
22
+ __decorate([property()], MyElement.prototype, "name", void 0), MyElement = __decorate([customElement("my-element")], MyElement);
23
+ export { MyElement as t };
@@ -1,34 +1,3 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { LitElement, css, html } from 'lit';
8
- import { customElement, property } from 'lit/decorators.js';
9
- let MyElement = class MyElement extends LitElement {
10
- constructor() {
11
- super(...arguments);
12
- this.name = 'World';
13
- }
14
- render() {
15
- return html `
16
- <h1>Hello, ${this.name}!</h1>
17
- `;
18
- }
19
- static { this.styles = css `
20
- :host {
21
- display: block;
22
- border: solid 1px gray;
23
- padding: 16px;
24
- max-width: 800px;
25
- }
26
- `; }
27
- };
28
- __decorate([
29
- property()
30
- ], MyElement.prototype, "name", void 0);
31
- MyElement = __decorate([
32
- customElement('my-element')
33
- ], MyElement);
1
+ import "./decorate-BnP3GfGh.js";
2
+ import { t as MyElement } from "./my-element-BWehTtOJ.js";
34
3
  export { MyElement };