@copilotkitnext/angular 1.52.0-next.5 → 1.52.0-next.6
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/esm2022/lib/components/chat/copilot-chat-assistant-message.mjs +3 -3
- package/dist/esm2022/lib/components/chat/copilot-chat-input.mjs +3 -3
- package/dist/esm2022/lib/components/chat/copilot-chat-message-view.mjs +3 -2
- package/dist/esm2022/lib/components/chat/copilot-chat-user-message.mjs +3 -3
- package/dist/esm2022/lib/components/chat/copilot-chat.mjs +3 -2
- package/dist/fesm2022/copilotkitnext-angular.mjs +10 -8
- package/dist/fesm2022/copilotkitnext-angular.mjs.map +1 -1
- package/dist/styles.css +58 -58
- package/eslint.config.mjs +1 -1
- package/package.json +6 -6
- package/scripts/scope-preflight.mjs +101 -0
package/dist/styles.css
CHANGED
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
@layer base {
|
|
37
|
-
*, ::after, ::before,
|
|
37
|
+
[data-copilotkit], [data-copilotkit] *, [data-copilotkit] ::after, [data-copilotkit] ::before, [data-copilotkit] ::file-selector-button {
|
|
38
38
|
box-sizing: border-box;
|
|
39
39
|
margin: 0;
|
|
40
40
|
padding: 0;
|
|
41
41
|
border: 0 solid;
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
[data-copilotkit], [data-copilotkit] {
|
|
44
44
|
line-height: 1.5;
|
|
45
45
|
-webkit-text-size-adjust: 100%;
|
|
46
46
|
tab-size: 4;
|
|
@@ -49,74 +49,74 @@
|
|
|
49
49
|
font-variation-settings: var(--default-font-variation-settings, normal);
|
|
50
50
|
-webkit-tap-highlight-color: transparent;
|
|
51
51
|
}
|
|
52
|
-
hr {
|
|
52
|
+
[data-copilotkit] hr, hr[data-copilotkit] {
|
|
53
53
|
height: 0;
|
|
54
54
|
color: inherit;
|
|
55
55
|
border-top-width: 1px;
|
|
56
56
|
}
|
|
57
|
-
abbr:where([title]) {
|
|
57
|
+
[data-copilotkit] abbr:where([title]), abbr:where([title])[data-copilotkit] {
|
|
58
58
|
-webkit-text-decoration: underline dotted;
|
|
59
59
|
text-decoration: underline dotted;
|
|
60
60
|
}
|
|
61
|
-
h1, h2, h3, h4, h5, h6 {
|
|
61
|
+
[data-copilotkit] h1, h1[data-copilotkit], [data-copilotkit] h2, h2[data-copilotkit], [data-copilotkit] h3, h3[data-copilotkit], [data-copilotkit] h4, h4[data-copilotkit], [data-copilotkit] h5, h5[data-copilotkit], [data-copilotkit] h6, h6[data-copilotkit] {
|
|
62
62
|
font-size: inherit;
|
|
63
63
|
font-weight: inherit;
|
|
64
64
|
}
|
|
65
|
-
a {
|
|
65
|
+
[data-copilotkit] a, a[data-copilotkit] {
|
|
66
66
|
color: inherit;
|
|
67
67
|
-webkit-text-decoration: inherit;
|
|
68
68
|
text-decoration: inherit;
|
|
69
69
|
}
|
|
70
|
-
b, strong {
|
|
70
|
+
[data-copilotkit] b, b[data-copilotkit], [data-copilotkit] strong, strong[data-copilotkit] {
|
|
71
71
|
font-weight: bolder;
|
|
72
72
|
}
|
|
73
|
-
code, kbd, samp, pre {
|
|
73
|
+
[data-copilotkit] code, code[data-copilotkit], [data-copilotkit] kbd, kbd[data-copilotkit], [data-copilotkit] samp, samp[data-copilotkit], [data-copilotkit] pre, pre[data-copilotkit] {
|
|
74
74
|
font-family: var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
|
|
75
75
|
font-feature-settings: var(--default-mono-font-feature-settings, normal);
|
|
76
76
|
font-variation-settings: var(--default-mono-font-variation-settings, normal);
|
|
77
77
|
font-size: 1em;
|
|
78
78
|
}
|
|
79
|
-
small {
|
|
79
|
+
[data-copilotkit] small, small[data-copilotkit] {
|
|
80
80
|
font-size: 80%;
|
|
81
81
|
}
|
|
82
|
-
sub, sup {
|
|
82
|
+
[data-copilotkit] sub, sub[data-copilotkit], [data-copilotkit] sup, sup[data-copilotkit] {
|
|
83
83
|
font-size: 75%;
|
|
84
84
|
line-height: 0;
|
|
85
85
|
position: relative;
|
|
86
86
|
vertical-align: baseline;
|
|
87
87
|
}
|
|
88
|
-
sub {
|
|
88
|
+
[data-copilotkit] sub, sub[data-copilotkit] {
|
|
89
89
|
bottom: -0.25em;
|
|
90
90
|
}
|
|
91
|
-
sup {
|
|
91
|
+
[data-copilotkit] sup, sup[data-copilotkit] {
|
|
92
92
|
top: -0.5em;
|
|
93
93
|
}
|
|
94
|
-
table {
|
|
94
|
+
[data-copilotkit] table, table[data-copilotkit] {
|
|
95
95
|
text-indent: 0;
|
|
96
96
|
border-color: inherit;
|
|
97
97
|
border-collapse: collapse;
|
|
98
98
|
}
|
|
99
|
-
:-moz-focusring {
|
|
99
|
+
[data-copilotkit] :-moz-focusring {
|
|
100
100
|
outline: auto;
|
|
101
101
|
}
|
|
102
|
-
progress {
|
|
102
|
+
[data-copilotkit] progress, progress[data-copilotkit] {
|
|
103
103
|
vertical-align: baseline;
|
|
104
104
|
}
|
|
105
|
-
summary {
|
|
105
|
+
[data-copilotkit] summary, summary[data-copilotkit] {
|
|
106
106
|
display: list-item;
|
|
107
107
|
}
|
|
108
|
-
ol, ul, menu {
|
|
108
|
+
[data-copilotkit] ol, ol[data-copilotkit], [data-copilotkit] ul, ul[data-copilotkit], [data-copilotkit] menu, menu[data-copilotkit] {
|
|
109
109
|
list-style: none;
|
|
110
110
|
}
|
|
111
|
-
img, svg, video, canvas, audio, iframe, embed, object {
|
|
111
|
+
[data-copilotkit] img, img[data-copilotkit], [data-copilotkit] svg, svg[data-copilotkit], [data-copilotkit] video, video[data-copilotkit], [data-copilotkit] canvas, canvas[data-copilotkit], [data-copilotkit] audio, audio[data-copilotkit], [data-copilotkit] iframe, iframe[data-copilotkit], [data-copilotkit] embed, embed[data-copilotkit], [data-copilotkit] object, object[data-copilotkit] {
|
|
112
112
|
display: block;
|
|
113
113
|
vertical-align: middle;
|
|
114
114
|
}
|
|
115
|
-
img, video {
|
|
115
|
+
[data-copilotkit] img, img[data-copilotkit], [data-copilotkit] video, video[data-copilotkit] {
|
|
116
116
|
max-width: 100%;
|
|
117
117
|
height: auto;
|
|
118
118
|
}
|
|
119
|
-
button, input, select, optgroup, textarea, ::file-selector-button {
|
|
119
|
+
[data-copilotkit] button, button[data-copilotkit], [data-copilotkit] input, input[data-copilotkit], [data-copilotkit] select, select[data-copilotkit], [data-copilotkit] optgroup, optgroup[data-copilotkit], [data-copilotkit] textarea, textarea[data-copilotkit], [data-copilotkit] ::file-selector-button {
|
|
120
120
|
font: inherit;
|
|
121
121
|
font-feature-settings: inherit;
|
|
122
122
|
font-variation-settings: inherit;
|
|
@@ -126,58 +126,58 @@
|
|
|
126
126
|
background-color: transparent;
|
|
127
127
|
opacity: 1;
|
|
128
128
|
}
|
|
129
|
-
:where(select:is([multiple], [size])) optgroup {
|
|
129
|
+
[data-copilotkit] :where(select:is([multiple], [size])) optgroup {
|
|
130
130
|
font-weight: bolder;
|
|
131
131
|
}
|
|
132
|
-
:where(select:is([multiple], [size])) optgroup option {
|
|
132
|
+
[data-copilotkit] :where(select:is([multiple], [size])) optgroup option {
|
|
133
133
|
padding-inline-start: 20px;
|
|
134
134
|
}
|
|
135
|
-
::file-selector-button {
|
|
135
|
+
[data-copilotkit] ::file-selector-button {
|
|
136
136
|
margin-inline-end: 4px;
|
|
137
137
|
}
|
|
138
|
-
::placeholder {
|
|
138
|
+
[data-copilotkit] ::placeholder {
|
|
139
139
|
opacity: 1;
|
|
140
140
|
}
|
|
141
141
|
@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {
|
|
142
|
-
::placeholder {
|
|
142
|
+
[data-copilotkit] ::placeholder {
|
|
143
143
|
color: currentcolor;
|
|
144
144
|
@supports (color: color-mix(in lab, red, red)) {
|
|
145
145
|
color: color-mix(in oklab, currentcolor 50%, transparent);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
textarea {
|
|
149
|
+
[data-copilotkit] textarea, textarea[data-copilotkit] {
|
|
150
150
|
resize: vertical;
|
|
151
151
|
}
|
|
152
|
-
::-webkit-search-decoration {
|
|
152
|
+
[data-copilotkit] ::-webkit-search-decoration {
|
|
153
153
|
-webkit-appearance: none;
|
|
154
154
|
}
|
|
155
|
-
::-webkit-date-and-time-value {
|
|
155
|
+
[data-copilotkit] ::-webkit-date-and-time-value {
|
|
156
156
|
min-height: 1lh;
|
|
157
157
|
text-align: inherit;
|
|
158
158
|
}
|
|
159
|
-
::-webkit-datetime-edit {
|
|
159
|
+
[data-copilotkit] ::-webkit-datetime-edit {
|
|
160
160
|
display: inline-flex;
|
|
161
161
|
}
|
|
162
|
-
::-webkit-datetime-edit-fields-wrapper {
|
|
162
|
+
[data-copilotkit] ::-webkit-datetime-edit-fields-wrapper {
|
|
163
163
|
padding: 0;
|
|
164
164
|
}
|
|
165
|
-
::-webkit-datetime-edit, ::-webkit-datetime-edit-year-field, ::-webkit-datetime-edit-month-field, ::-webkit-datetime-edit-day-field, ::-webkit-datetime-edit-hour-field, ::-webkit-datetime-edit-minute-field, ::-webkit-datetime-edit-second-field, ::-webkit-datetime-edit-millisecond-field, ::-webkit-datetime-edit-meridiem-field {
|
|
165
|
+
[data-copilotkit] ::-webkit-datetime-edit, [data-copilotkit] ::-webkit-datetime-edit-year-field, [data-copilotkit] ::-webkit-datetime-edit-month-field, [data-copilotkit] ::-webkit-datetime-edit-day-field, [data-copilotkit] ::-webkit-datetime-edit-hour-field, [data-copilotkit] ::-webkit-datetime-edit-minute-field, [data-copilotkit] ::-webkit-datetime-edit-second-field, [data-copilotkit] ::-webkit-datetime-edit-millisecond-field, [data-copilotkit] ::-webkit-datetime-edit-meridiem-field {
|
|
166
166
|
padding-block: 0;
|
|
167
167
|
}
|
|
168
|
-
::-webkit-calendar-picker-indicator {
|
|
168
|
+
[data-copilotkit] ::-webkit-calendar-picker-indicator {
|
|
169
169
|
line-height: 1;
|
|
170
170
|
}
|
|
171
|
-
:-moz-ui-invalid {
|
|
171
|
+
[data-copilotkit] :-moz-ui-invalid {
|
|
172
172
|
box-shadow: none;
|
|
173
173
|
}
|
|
174
|
-
button, input:where([type="button"], [type="reset"], [type="submit"]), ::file-selector-button {
|
|
174
|
+
[data-copilotkit] button, button[data-copilotkit], [data-copilotkit] input:where([type="button"], [type="reset"], [type="submit"]), input:where([type="button"], [type="reset"], [type="submit"])[data-copilotkit], [data-copilotkit] ::file-selector-button {
|
|
175
175
|
appearance: button;
|
|
176
176
|
}
|
|
177
|
-
::-webkit-inner-spin-button, ::-webkit-outer-spin-button {
|
|
177
|
+
[data-copilotkit] ::-webkit-inner-spin-button, [data-copilotkit] ::-webkit-outer-spin-button {
|
|
178
178
|
height: auto;
|
|
179
179
|
}
|
|
180
|
-
[hidden]:where(:not([hidden="until-found"])) {
|
|
180
|
+
[data-copilotkit] [hidden]:where(:not([hidden="until-found"])), [hidden]:where(:not([hidden="until-found"]))[data-copilotkit] {
|
|
181
181
|
display: none !important;
|
|
182
182
|
}
|
|
183
183
|
}
|
|
@@ -1479,7 +1479,7 @@
|
|
|
1479
1479
|
inherits: false;
|
|
1480
1480
|
initial-value: 0;
|
|
1481
1481
|
}
|
|
1482
|
-
|
|
1482
|
+
[data-copilotkit] {
|
|
1483
1483
|
--background: oklch(1 0 0);
|
|
1484
1484
|
--foreground: oklch(0.145 0 0);
|
|
1485
1485
|
--card: oklch(1 0 0);
|
|
@@ -1514,7 +1514,7 @@
|
|
|
1514
1514
|
--sidebar-border: oklch(0.922 0 0);
|
|
1515
1515
|
--sidebar-ring: oklch(0.708 0 0);
|
|
1516
1516
|
}
|
|
1517
|
-
.dark {
|
|
1517
|
+
.dark [data-copilotkit], [data-copilotkit].dark {
|
|
1518
1518
|
--background: oklch(0.145 0 0);
|
|
1519
1519
|
--foreground: oklch(0.985 0 0);
|
|
1520
1520
|
--card: oklch(0.145 0 0);
|
|
@@ -1549,38 +1549,38 @@
|
|
|
1549
1549
|
--sidebar-ring: oklch(0.439 0 0);
|
|
1550
1550
|
}
|
|
1551
1551
|
@layer base {
|
|
1552
|
-
* {
|
|
1552
|
+
[data-copilotkit], [data-copilotkit] * {
|
|
1553
1553
|
border-color: var(--border);
|
|
1554
1554
|
outline-color: var(--ring);
|
|
1555
1555
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1556
1556
|
outline-color: color-mix(in oklab, var(--ring) 50%, transparent);
|
|
1557
1557
|
}
|
|
1558
1558
|
}
|
|
1559
|
-
|
|
1560
|
-
background-color: var(--background);
|
|
1559
|
+
[data-copilotkit] {
|
|
1561
1560
|
color: var(--foreground);
|
|
1561
|
+
background-color: var(--background);
|
|
1562
1562
|
}
|
|
1563
1563
|
}
|
|
1564
|
-
.prose {
|
|
1564
|
+
[data-copilotkit] .prose {
|
|
1565
1565
|
-webkit-font-smoothing: antialiased;
|
|
1566
1566
|
-moz-osx-font-smoothing: grayscale;
|
|
1567
1567
|
}
|
|
1568
|
-
.prose :where(code):not( :where([class~="not-prose"], [class~="not-prose"] *) )::before {
|
|
1568
|
+
[data-copilotkit] .prose :where(code):not( :where([class~="not-prose"], [class~="not-prose"] *) )::before {
|
|
1569
1569
|
content: none;
|
|
1570
1570
|
}
|
|
1571
|
-
.prose :where(code):not( :where([class~="not-prose"], [class~="not-prose"] *) )::after {
|
|
1571
|
+
[data-copilotkit] .prose :where(code):not( :where([class~="not-prose"], [class~="not-prose"] *) )::after {
|
|
1572
1572
|
content: none;
|
|
1573
1573
|
}
|
|
1574
|
-
.prose :where(code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
|
|
1574
|
+
[data-copilotkit] .prose :where(code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
|
|
1575
1575
|
font-weight: 400;
|
|
1576
1576
|
}
|
|
1577
|
-
.prose h1 {
|
|
1577
|
+
[data-copilotkit] .prose h1 {
|
|
1578
1578
|
margin-block-end: 8px;
|
|
1579
1579
|
margin-bottom: 8px;
|
|
1580
1580
|
font-size: 24px;
|
|
1581
1581
|
font-weight: 600;
|
|
1582
1582
|
}
|
|
1583
|
-
.prose h2 {
|
|
1583
|
+
[data-copilotkit] .prose h2 {
|
|
1584
1584
|
margin-block-end: 4px;
|
|
1585
1585
|
margin-block-start: 16px;
|
|
1586
1586
|
margin-top: 16px;
|
|
@@ -1588,7 +1588,7 @@
|
|
|
1588
1588
|
font-size: 20px;
|
|
1589
1589
|
font-weight: 600;
|
|
1590
1590
|
}
|
|
1591
|
-
.prose h3 {
|
|
1591
|
+
[data-copilotkit] .prose h3 {
|
|
1592
1592
|
margin-block-end: 4px;
|
|
1593
1593
|
margin-block-start: 16px;
|
|
1594
1594
|
margin-top: 16px;
|
|
@@ -1596,27 +1596,27 @@
|
|
|
1596
1596
|
font-size: 18px;
|
|
1597
1597
|
font-weight: 600;
|
|
1598
1598
|
}
|
|
1599
|
-
.prose p {
|
|
1599
|
+
[data-copilotkit] .prose p {
|
|
1600
1600
|
margin-block-start: 8px;
|
|
1601
1601
|
margin-block-end: 4px;
|
|
1602
1602
|
margin-top: 4px;
|
|
1603
1603
|
margin-bottom: 8px;
|
|
1604
1604
|
}
|
|
1605
|
-
.prose a {
|
|
1605
|
+
[data-copilotkit] .prose a {
|
|
1606
1606
|
color: #2964aa;
|
|
1607
1607
|
text-decoration: none;
|
|
1608
1608
|
}
|
|
1609
|
-
.prose a:hover {
|
|
1609
|
+
[data-copilotkit] .prose a:hover {
|
|
1610
1610
|
color: #749ac8;
|
|
1611
1611
|
}
|
|
1612
|
-
.prose :where(blockquote p:first-of-type):not( :where([class~="not-prose"], [class~="not-prose"] *) )::before {
|
|
1612
|
+
[data-copilotkit] .prose :where(blockquote p:first-of-type):not( :where([class~="not-prose"], [class~="not-prose"] *) )::before {
|
|
1613
1613
|
content: none;
|
|
1614
1614
|
}
|
|
1615
|
-
.prose blockquote {
|
|
1615
|
+
[data-copilotkit] .prose blockquote {
|
|
1616
1616
|
font-style: normal;
|
|
1617
1617
|
font-weight: 400;
|
|
1618
1618
|
}
|
|
1619
|
-
.prose input[type="checkbox"] {
|
|
1619
|
+
[data-copilotkit] .prose input[type="checkbox"] {
|
|
1620
1620
|
appearance: none;
|
|
1621
1621
|
background-color: #fff;
|
|
1622
1622
|
background-origin: border-box;
|
|
@@ -1635,7 +1635,7 @@
|
|
|
1635
1635
|
width: 1rem;
|
|
1636
1636
|
border-radius: 2px;
|
|
1637
1637
|
}
|
|
1638
|
-
.prose input[type="checkbox"]:checked {
|
|
1638
|
+
[data-copilotkit] .prose input[type="checkbox"]:checked {
|
|
1639
1639
|
background-color: #004f99;
|
|
1640
1640
|
border-color: #004f99;
|
|
1641
1641
|
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E");
|
|
@@ -1643,17 +1643,17 @@
|
|
|
1643
1643
|
background-repeat: no-repeat;
|
|
1644
1644
|
background-size: 100% 100%;
|
|
1645
1645
|
}
|
|
1646
|
-
.prose em {
|
|
1646
|
+
[data-copilotkit] .prose em {
|
|
1647
1647
|
color: var(--foreground);
|
|
1648
1648
|
}
|
|
1649
|
-
.prose hr {
|
|
1649
|
+
[data-copilotkit] .prose hr {
|
|
1650
1650
|
margin-block-start: 0px;
|
|
1651
1651
|
margin-block-end: 0px;
|
|
1652
1652
|
margin-top: 28px;
|
|
1653
1653
|
margin-bottom: 28px;
|
|
1654
1654
|
color: rgb(13, 13, 13);
|
|
1655
1655
|
}
|
|
1656
|
-
.prose td {
|
|
1656
|
+
[data-copilotkit] .prose td {
|
|
1657
1657
|
color: var(--foreground);
|
|
1658
1658
|
}
|
|
1659
1659
|
@property --tw-rotate-x {
|
package/eslint.config.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@copilotkitnext/angular",
|
|
3
|
-
"version": "1.52.0-next.
|
|
3
|
+
"version": "1.52.0-next.6",
|
|
4
4
|
"description": "Angular library for CopilotKit",
|
|
5
5
|
"main": "dist/fesm2022/copilotkitnext-angular.mjs",
|
|
6
6
|
"module": "dist/fesm2022/copilotkitnext-angular.mjs",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"tailwind-merge": "^2.6.0",
|
|
25
25
|
"zod": "^3.22.4",
|
|
26
26
|
"tslib": "^2.6.0",
|
|
27
|
-
"@copilotkitnext/core": "1.52.0-next.
|
|
28
|
-
"@copilotkitnext/shared": "1.52.0-next.
|
|
27
|
+
"@copilotkitnext/core": "1.52.0-next.6",
|
|
28
|
+
"@copilotkitnext/shared": "1.52.0-next.6"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@angular/cdk": "^18.0.0 || ^19.0.0",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"vite": "^7.1.4",
|
|
69
69
|
"vitest": "^3.2.4",
|
|
70
70
|
"zone.js": "^0.14.0",
|
|
71
|
-
"@copilotkitnext/eslint-config": "1.52.0-next.
|
|
72
|
-
"@copilotkitnext/typescript-config": "1.52.0-next.
|
|
71
|
+
"@copilotkitnext/eslint-config": "1.52.0-next.6",
|
|
72
|
+
"@copilotkitnext/typescript-config": "1.52.0-next.6"
|
|
73
73
|
},
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"license": "MIT",
|
|
83
83
|
"scripts": {
|
|
84
84
|
"build": "ng-packagr -p ng-package.json && npm run build:css",
|
|
85
|
-
"build:css": "tailwindcss -i ./src/styles/globals.css -o ./dist/styles.css",
|
|
85
|
+
"build:css": "tailwindcss -i ./src/styles/globals.css -o ./dist/styles.css && node scripts/scope-preflight.mjs ./dist/styles.css",
|
|
86
86
|
"dev": "concurrently \"ng-packagr -p ng-package.json --watch\" \"npm run dev:css\"",
|
|
87
87
|
"dev:css": "tailwindcss -i ./src/styles/globals.css -o ./dist/styles.css --watch",
|
|
88
88
|
"lint": "eslint .",
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-processes compiled Tailwind CSS to scope all @layer base rules
|
|
3
|
+
* under [data-copilotkit], preventing CopilotKit styles from leaking
|
|
4
|
+
* into the host application.
|
|
5
|
+
*
|
|
6
|
+
* Run after `tailwindcss` CLI: node scripts/scope-preflight.mjs <file>
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { readFileSync, writeFileSync } from "fs";
|
|
10
|
+
import postcss from "postcss";
|
|
11
|
+
|
|
12
|
+
const SCOPE = "[data-copilotkit]";
|
|
13
|
+
const file = process.argv[2];
|
|
14
|
+
if (!file) {
|
|
15
|
+
console.error("Usage: node scripts/scope-preflight.mjs <css-file>");
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Selectors that are already scoped and should be left alone. */
|
|
20
|
+
function isAlreadyScoped(selector) {
|
|
21
|
+
return (
|
|
22
|
+
selector.includes("[data-copilot") ||
|
|
23
|
+
selector.includes("[data-sidebar")
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Rewrite a single selector to be scoped under [data-copilotkit]. */
|
|
28
|
+
function scopeSelector(sel) {
|
|
29
|
+
sel = sel.trim();
|
|
30
|
+
|
|
31
|
+
// Already scoped — keep as-is
|
|
32
|
+
if (isAlreadyScoped(sel)) return sel;
|
|
33
|
+
|
|
34
|
+
// html, :host → [data-copilotkit]
|
|
35
|
+
if (sel === "html" || sel === ":host" || sel === "html,:host") {
|
|
36
|
+
return SCOPE;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// body → null (remove)
|
|
40
|
+
if (sel === "body") return null;
|
|
41
|
+
|
|
42
|
+
// ::backdrop → null (cannot be scoped to a container)
|
|
43
|
+
if (sel === "::backdrop") return null;
|
|
44
|
+
|
|
45
|
+
// Bare universal selector → scope to container + descendants
|
|
46
|
+
if (sel === "*") return `${SCOPE}, ${SCOPE} *`;
|
|
47
|
+
|
|
48
|
+
// Pseudo-elements (::) and vendor pseudo-classes (:-) → descendant only
|
|
49
|
+
// These can't be combined with an attribute selector suffix
|
|
50
|
+
if (sel.startsWith(":")) {
|
|
51
|
+
return `${SCOPE} ${sel}`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Element / attribute selectors → descendant AND self-matching
|
|
55
|
+
// e.g. button → [data-copilotkit] button, button[data-copilotkit]
|
|
56
|
+
// This ensures <button data-copilotkit> also receives the preflight reset
|
|
57
|
+
return `${SCOPE} ${sel}, ${sel}${SCOPE}`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function scopeRule(rule) {
|
|
61
|
+
const newSelectors = [];
|
|
62
|
+
|
|
63
|
+
for (const sel of rule.selectors) {
|
|
64
|
+
const scoped = scopeSelector(sel);
|
|
65
|
+
if (scoped !== null) {
|
|
66
|
+
// scopeSelector may return comma-separated selectors (for *)
|
|
67
|
+
if (typeof scoped === "string" && scoped.includes(", ")) {
|
|
68
|
+
newSelectors.push(...scoped.split(", "));
|
|
69
|
+
} else if (scoped) {
|
|
70
|
+
newSelectors.push(scoped);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (newSelectors.length === 0) {
|
|
76
|
+
rule.remove();
|
|
77
|
+
} else {
|
|
78
|
+
rule.selectors = newSelectors;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Recursively scope all rules within a node (handles @supports, @media, etc.) */
|
|
83
|
+
function scopeChildren(node) {
|
|
84
|
+
node.walk((child) => {
|
|
85
|
+
if (child.type === "rule") {
|
|
86
|
+
scopeRule(child);
|
|
87
|
+
}
|
|
88
|
+
// @supports / @media blocks are walked automatically
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// --- Main ---
|
|
93
|
+
const css = readFileSync(file, "utf8");
|
|
94
|
+
const root = postcss.parse(css);
|
|
95
|
+
|
|
96
|
+
root.walkAtRules("layer", (layer) => {
|
|
97
|
+
if (layer.params !== "base") return;
|
|
98
|
+
scopeChildren(layer);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
writeFileSync(file, root.toString());
|