@juspay/svelte-ui-components 3.2.0 → 3.2.2
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 +55 -2
- package/dist/ThemeSwitcher/ThemeSwitcher.svelte +4 -0
- package/dist-wc/index.js +2047 -841
- package/package.json +20 -5
- package/scripts/codemod/README.md +76 -0
- package/scripts/codemod/cli.ts +206 -0
- package/scripts/codemod/map.ts +118 -0
- package/scripts/codemod/transform.ts +549 -0
- package/scripts/codemod/tsconfig.json +15 -0
- package/scripts/codemod/wc-children.ts +75 -0
- package/scripts/postinstall.mjs +56 -0
package/README.md
CHANGED
|
@@ -38,6 +38,53 @@ This library takes a different approach: **components are unstyled by default**
|
|
|
38
38
|
|
|
39
39
|
---
|
|
40
40
|
|
|
41
|
+
## Coming in 4.0.0: one breaking change
|
|
42
|
+
|
|
43
|
+
Advance notice, not a change in this release. **Nothing below has happened yet** —
|
|
44
|
+
the current 3.x line still accepts everything it always did.
|
|
45
|
+
|
|
46
|
+
In 4.0.0, `children` stops being a declared property on `sui-chat-bubble`,
|
|
47
|
+
`sui-draggable` and `sui-resizable`. Assigning it will set an inert expando and
|
|
48
|
+
the content will silently disappear. Pass the content as light-DOM children
|
|
49
|
+
instead, which those wrappers will forward through their default slot:
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
el.children = mySnippet; // before — no longer works
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<sui-draggable><div>…</div></sui-draggable>
|
|
57
|
+
<!-- after -->
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Reading `element.children` is what the change fixes.** Declaring the property
|
|
61
|
+
replaces the inherited accessor, so on those three elements `element.children`
|
|
62
|
+
returns `undefined` rather than an `HTMLCollection` today and
|
|
63
|
+
`el.children.length` throws. That is why the declaration has to go, and why it
|
|
64
|
+
cannot go before a major.
|
|
65
|
+
|
|
66
|
+
You can find affected call sites now, well before the major — this reports and
|
|
67
|
+
writes nothing:
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
npx sui-codemod --dry-run ./src
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
It flags `.children =` assignments only in files that also mention one of the
|
|
74
|
+
three elements, so ordinary DOM code is not reported. The fix moves content from
|
|
75
|
+
a JavaScript assignment into markup, which is a decision about where content is
|
|
76
|
+
authored, so the tool deliberately does not rewrite it for you. Requires Node
|
|
77
|
+
≥ 22.18; `typescript` is an optional peer dependency that the codemod's
|
|
78
|
+
Svelte-parsing paths need.
|
|
79
|
+
|
|
80
|
+
Nothing else in the custom-element surface breaks. Everything this release adds —
|
|
81
|
+
185 wrapper props, three previously unregistered elements, the `spellcheck` and
|
|
82
|
+
`aria-haspopup` mappings, the snippet props on Banner, ListItem, Menu, Modal and
|
|
83
|
+
Button, Accordion's `disabled`, LottiePlayer's callbacks — is new surface or a
|
|
84
|
+
fix to something that did not work.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
41
88
|
## Quick Start
|
|
42
89
|
|
|
43
90
|
```svelte
|
|
@@ -165,8 +212,14 @@ component.
|
|
|
165
212
|
<script type="module" src="https://juspay.github.io/svelte-ui-components/wc/index.js"></script>
|
|
166
213
|
|
|
167
214
|
<!-- Pinned to an npm version, via jsDelivr or unpkg -->
|
|
168
|
-
<script
|
|
169
|
-
|
|
215
|
+
<script
|
|
216
|
+
type="module"
|
|
217
|
+
src="https://cdn.jsdelivr.net/npm/@juspay/svelte-ui-components@latest/dist-wc/index.js"
|
|
218
|
+
></script>
|
|
219
|
+
<script
|
|
220
|
+
type="module"
|
|
221
|
+
src="https://unpkg.com/@juspay/svelte-ui-components@latest/dist-wc/index.js"
|
|
222
|
+
></script>
|
|
170
223
|
|
|
171
224
|
<sui-button>Click me</sui-button>
|
|
172
225
|
<sui-input placeholder="Type here"></sui-input>
|