polaris-vue-elements 0.4.0 → 0.4.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/CHANGELOG.md +26 -2
- package/README.md +5 -9
- package/dist/index.js +36 -33
- package/dist/index.js.map +1 -1
- package/dist/runtime/createWrapper.d.ts +2 -1
- package/dist/runtime/createWrapper.d.ts.map +1 -1
- package/package.json +15 -9
package/CHANGELOG.md
CHANGED
|
@@ -6,11 +6,33 @@ All notable changes to `polaris-vue-elements` are documented here. The format is
|
|
|
6
6
|
minor releases may include breaking changes, which are always called out below.
|
|
7
7
|
|
|
8
8
|
Wrapper and type changes follow `@shopify/polaris-types`, whose major version matches the
|
|
9
|
-
[Polaris CDN](https://polaris-vue.
|
|
9
|
+
[Polaris CDN](https://polaris-vue-elements.dev/guide/quirks)
|
|
10
10
|
major your app loads (`polaris-1.js`, `polaris-2.js`, …).
|
|
11
11
|
|
|
12
12
|
## [Unreleased]
|
|
13
13
|
|
|
14
|
+
## [0.4.2] - 2026-10-30
|
|
15
|
+
|
|
16
|
+
Still generated from `@shopify/polaris-types` 2.0.0. No changes to the components.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- The docs moved to [polaris-vue-elements.dev](https://polaris-vue-elements.dev). The old
|
|
21
|
+
`polaris-vue.vict0r.net` links redirect there. The package `homepage` now points to the new
|
|
22
|
+
domain, and the npm description and keywords mention Shopify apps.
|
|
23
|
+
- New guide: [Build a Shopify embedded app with Vue 3](https://polaris-vue-elements.dev/guide/shopify-embedded-app).
|
|
24
|
+
|
|
25
|
+
## [0.4.1] - 2026-10-29
|
|
26
|
+
|
|
27
|
+
Still generated from `@shopify/polaris-types` 2.0.0.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- A boolean prop written as a bare attribute (`<SChip removable />`, `<SButton disabled />`) is
|
|
32
|
+
now on. Vue passes such an attribute to a prop declared without a Boolean type as `''`, which
|
|
33
|
+
the wrapper treated as falsy, so the attribute never reached the element and only
|
|
34
|
+
`:removable="true"` worked.
|
|
35
|
+
|
|
14
36
|
## [0.4.0] - 2026-10-27
|
|
15
37
|
|
|
16
38
|
Still generated from `@shopify/polaris-types` 2.0.0.
|
|
@@ -96,7 +118,9 @@ Initial release: typed Vue 3 wrappers for the 59 Shopify Polaris web components
|
|
|
96
118
|
`showOverlay()` / `hideOverlay()` / `toggleOverlay()`).
|
|
97
119
|
- ESM build with bundled type declarations; `vue` ^3.5 as a peer dependency.
|
|
98
120
|
|
|
99
|
-
[Unreleased]: https://github.com/HQCuong/polaris-vue/compare/v0.4.
|
|
121
|
+
[Unreleased]: https://github.com/HQCuong/polaris-vue/compare/v0.4.2...HEAD
|
|
122
|
+
[0.4.2]: https://github.com/HQCuong/polaris-vue/compare/v0.4.1...v0.4.2
|
|
123
|
+
[0.4.1]: https://github.com/HQCuong/polaris-vue/compare/v0.4.0...v0.4.1
|
|
100
124
|
[0.4.0]: https://github.com/HQCuong/polaris-vue/compare/v0.3.0...v0.4.0
|
|
101
125
|
[0.3.0]: https://github.com/HQCuong/polaris-vue/compare/v0.2.0...v0.3.0
|
|
102
126
|
[0.2.0]: https://github.com/HQCuong/polaris-vue/compare/v0.1.0...v0.2.0
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Typed Vue 3 wrapper components for [Shopify Polaris web components](https://shopify.dev/docs/api/app-home/web-components) — the `s-*` custom elements used to build Shopify App Home (embedded admin) apps.
|
|
4
4
|
|
|
5
|
-
**📖 Documentation: [polaris-vue.
|
|
5
|
+
**📖 Documentation: [polaris-vue-elements.dev](https://polaris-vue-elements.dev/)** — guides, known quirks, and live examples for all 62 components.
|
|
6
6
|
|
|
7
7
|
The Polaris runtime itself is loaded from Shopify's CDN (the `polaris-2.js` stable channel receives compatible updates automatically). This library gives you an idiomatic, fully typed Vue surface on top of it:
|
|
8
8
|
|
|
@@ -28,7 +28,7 @@ The wrappers are presentational only — your host app must load the Polaris run
|
|
|
28
28
|
<script src="https://cdn.shopify.com/shopifycloud/polaris-2.js"></script>
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
`polaris-2.js` is Shopify's stable channel and brings the admin's new visual design. Apps still on `polaris-1.js` keep working — 2.0's component API is the same as 1.1 apart from a few additions. See [Polaris 2.0 and the new admin design](https://polaris-vue.
|
|
31
|
+
`polaris-2.js` is Shopify's stable channel and brings the admin's new visual design. Apps still on `polaris-1.js` keep working — 2.0's component API is the same as 1.1 apart from a few additions. See [Polaris 2.0 and the new admin design](https://polaris-vue-elements.dev/guide/getting-started#polaris-2-0-and-the-new-admin-design).
|
|
32
32
|
|
|
33
33
|
```ts
|
|
34
34
|
// vite.config.ts
|
|
@@ -57,9 +57,9 @@ const name = ref('')
|
|
|
57
57
|
</template>
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
Prefer writing Polaris's own `<s-button>` tags? Add `"types": ["polaris-vue-elements/elements"]` to your `tsconfig.json` and Volar / `vue-tsc` type-check raw `<s-*>` tags too (types only; `v-model` stays wrapper-only). See [Typing raw `<s-*>` tags](https://polaris-vue.
|
|
60
|
+
Prefer writing Polaris's own `<s-button>` tags? Add `"types": ["polaris-vue-elements/elements"]` to your `tsconfig.json` and Volar / `vue-tsc` type-check raw `<s-*>` tags too (types only; `v-model` stays wrapper-only). See [Typing raw `<s-*>` tags](https://polaris-vue-elements.dev/guide/getting-started#_7-typing-raw-s-tags-optional).
|
|
61
61
|
|
|
62
|
-
Full documentation — guides, known quirks, and generated reference pages with live examples for all 62 components — is at **[polaris-vue.
|
|
62
|
+
Full documentation — guides, known quirks, and generated reference pages with live examples for all 62 components — is at **[polaris-vue-elements.dev](https://polaris-vue-elements.dev/)** (source in `docs/`, `npm run docs:dev` to run locally). Building a Shopify app? Start with the [embedded app guide](https://polaris-vue-elements.dev/guide/shopify-embedded-app).
|
|
63
63
|
|
|
64
64
|
## Architecture
|
|
65
65
|
|
|
@@ -101,11 +101,7 @@ npm run build:lib # build the publishable package into dist/
|
|
|
101
101
|
|
|
102
102
|
## Contributing
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
2. **New form component needs v-model?** Add one line to `src/lib/overrides.ts` (the `overrides.spec.ts` drift guard will point at exactly what's missing).
|
|
106
|
-
3. **Curated docs example?** Add `docs/examples/<tag>.md` (complex live demos go in `docs/examples/demos/*.vue` — SFCs are immune to markdown-it mangling); the docs generator inlines it automatically.
|
|
107
|
-
4. Before opening a PR, make sure the full suite passes: `npm run generate && npm run docs:generate && npx vitest run && npm run type-check && npx oxlint . && npx eslint .` — CI runs the same checks plus a codegen-freshness diff.
|
|
108
|
-
5. Behavioral claims about Polaris components (slot rules, rendering quirks) should be verified against the real CDN runtime in a browser, not just jsdom — see `docs/guide/quirks.md` for previously verified findings.
|
|
104
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for setup, ground rules and the pre-PR checklist.
|
|
109
105
|
|
|
110
106
|
## Releasing
|
|
111
107
|
|
package/dist/index.js
CHANGED
|
@@ -71,62 +71,65 @@ var r = {
|
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
// src/lib/runtime/createWrapper.ts
|
|
74
|
-
function i(e
|
|
74
|
+
function i(e) {
|
|
75
|
+
return e === "" || !!e;
|
|
76
|
+
}
|
|
77
|
+
function a(e, t) {
|
|
75
78
|
let n = e;
|
|
76
79
|
for (let [e, r] of t) n[e] = r;
|
|
77
80
|
}
|
|
78
|
-
function
|
|
79
|
-
let
|
|
80
|
-
for (let e of
|
|
81
|
+
function o(o) {
|
|
82
|
+
let s = r[o.tagName], c = {};
|
|
83
|
+
for (let e of o.props) c[e.name] = {
|
|
81
84
|
type: null,
|
|
82
85
|
default: void 0
|
|
83
86
|
};
|
|
84
|
-
return
|
|
87
|
+
return s && (c.modelValue = {
|
|
85
88
|
type: null,
|
|
86
89
|
default: void 0
|
|
87
90
|
}), t({
|
|
88
|
-
name:
|
|
91
|
+
name: o.tagName,
|
|
89
92
|
inheritAttrs: !1,
|
|
90
|
-
props:
|
|
91
|
-
emits:
|
|
92
|
-
setup(t, { attrs: r, slots:
|
|
93
|
+
props: c,
|
|
94
|
+
emits: s ? ["update:modelValue"] : [],
|
|
95
|
+
setup(t, { attrs: r, slots: c, emit: l }) {
|
|
93
96
|
return () => {
|
|
94
|
-
let
|
|
95
|
-
for (let e of
|
|
96
|
-
let t =
|
|
97
|
-
t !== void 0 && (e.attribute ? e.type === "boolean" ? t && (
|
|
97
|
+
let u = { ...r }, d = [], f = t;
|
|
98
|
+
for (let e of o.props) {
|
|
99
|
+
let t = f[e.name];
|
|
100
|
+
t !== void 0 && (e.attribute ? e.type === "boolean" ? i(t) && (u[e.attribute] = "") : u[e.attribute] = t : d.push([e.name, t]));
|
|
98
101
|
}
|
|
99
|
-
if (
|
|
100
|
-
let e =
|
|
102
|
+
if (s) {
|
|
103
|
+
let e = f.modelValue;
|
|
101
104
|
if (e !== void 0) {
|
|
102
|
-
let t =
|
|
103
|
-
t?.attribute ? t.type === "boolean" ? e && (
|
|
105
|
+
let t = o.props.find((e) => e.name === s.prop);
|
|
106
|
+
t?.attribute ? t.type === "boolean" ? i(e) && (u[t.attribute] = "") : u[t.attribute] = e : d.push([s.prop, e]);
|
|
104
107
|
}
|
|
105
|
-
let t = `on${
|
|
106
|
-
|
|
108
|
+
let t = `on${s.event.charAt(0).toUpperCase()}${s.event.slice(1)}`, n = u[t];
|
|
109
|
+
u[t] = (e) => {
|
|
107
110
|
let t = e.target;
|
|
108
|
-
|
|
111
|
+
l("update:modelValue", t[s.prop]), n?.(e);
|
|
109
112
|
};
|
|
110
113
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
|
|
114
|
+
d.length > 0 && (u.onVnodeMounted = (e) => {
|
|
115
|
+
a(e.el, d);
|
|
116
|
+
}, u.onVnodeUpdated = (e) => {
|
|
117
|
+
a(e.el, d);
|
|
115
118
|
});
|
|
116
|
-
let
|
|
117
|
-
|
|
118
|
-
for (let t of Object.keys(
|
|
119
|
+
let p = [];
|
|
120
|
+
c.default && p.push(...c.default());
|
|
121
|
+
for (let t of Object.keys(c)) {
|
|
119
122
|
if (t === "default") continue;
|
|
120
|
-
let n =
|
|
121
|
-
if (n) for (let r of n())
|
|
123
|
+
let n = c[t];
|
|
124
|
+
if (n) for (let r of n()) p.push(e(r, { slot: t }));
|
|
122
125
|
}
|
|
123
|
-
return n(
|
|
126
|
+
return n(o.tagName, u, p);
|
|
124
127
|
};
|
|
125
128
|
}
|
|
126
129
|
});
|
|
127
130
|
}
|
|
128
131
|
// src/lib/generated/metadata.ts
|
|
129
|
-
var
|
|
132
|
+
var s = {
|
|
130
133
|
SAvatar: {
|
|
131
134
|
tagName: "s-avatar",
|
|
132
135
|
props: [
|
|
@@ -3559,7 +3562,7 @@ var o = {
|
|
|
3559
3562
|
],
|
|
3560
3563
|
slots: ["details", "error"]
|
|
3561
3564
|
}
|
|
3562
|
-
},
|
|
3563
|
-
export {
|
|
3565
|
+
}, c = o(s.SAvatar), l = o(s.SBadge), u = o(s.SBanner), d = o(s.SBox), f = o(s.SButton), p = o(s.SButtonGroup), ee = o(s.SCheckbox), m = o(s.SChip), h = o(s.SChoice), g = o(s.SChoiceList), _ = o(s.SClickable), v = o(s.SClickableChip), y = o(s.SColorField), b = o(s.SColorPicker), x = o(s.SDateField), S = o(s.SDatePicker), C = o(s.SDivider), w = o(s.SDropZone), T = o(s.SEmailField), E = o(s.SEmptyState), D = o(s.SGrid), O = o(s.SGridItem), k = o(s.SHeading), A = o(s.SIcon), j = o(s.SImage), M = o(s.SLink), N = o(s.SListItem), P = o(s.SMenu), F = o(s.SModal), I = o(s.SMoneyField), L = o(s.SNumber), R = o(s.SNumberField), z = o(s.SOption), B = o(s.SOptionGroup), V = o(s.SOrderedList), te = o(s.SPage), H = o(s.SParagraph), U = o(s.SPasswordField), W = o(s.SPopover), G = o(s.SPressButton), K = o(s.SProgress), q = o(s.SQueryContainer), J = o(s.SScrollBox), Y = o(s.SSearchField), X = o(s.SSection), Z = o(s.SSelect), Q = o(s.SSpinner), ne = o(s.SStack), re = o(s.SSwitch), ie = o(s.STable), ae = o(s.STableBody), oe = o(s.STableCell), $ = o(s.STableHeader), se = o(s.STableHeaderRow), ce = o(s.STableRow), le = o(s.SText), ue = o(s.STextArea), de = o(s.STextField), fe = o(s.SThumbnail), pe = o(s.STooltip), me = o(s.SUnorderedList), he = o(s.SUrlField), ge = /* @__PURE__ */ "s-avatar.s-badge.s-banner.s-box.s-button.s-button-group.s-checkbox.s-chip.s-choice.s-choice-list.s-clickable.s-clickable-chip.s-color-field.s-color-picker.s-date-field.s-date-picker.s-divider.s-drop-zone.s-email-field.s-empty-state.s-grid.s-grid-item.s-heading.s-icon.s-image.s-link.s-list-item.s-menu.s-modal.s-money-field.s-number.s-number-field.s-option.s-option-group.s-ordered-list.s-page.s-paragraph.s-password-field.s-popover.s-press-button.s-progress.s-query-container.s-scroll-box.s-search-field.s-section.s-select.s-spinner.s-stack.s-switch.s-table.s-table-body.s-table-cell.s-table-header.s-table-header-row.s-table-row.s-text.s-text-area.s-text-field.s-thumbnail.s-tooltip.s-unordered-list.s-url-field".split(".");
|
|
3566
|
+
export { c as SAvatar, l as SBadge, u as SBanner, d as SBox, f as SButton, p as SButtonGroup, ee as SCheckbox, m as SChip, h as SChoice, g as SChoiceList, _ as SClickable, v as SClickableChip, y as SColorField, b as SColorPicker, x as SDateField, S as SDatePicker, C as SDivider, w as SDropZone, T as SEmailField, E as SEmptyState, D as SGrid, O as SGridItem, k as SHeading, A as SIcon, j as SImage, M as SLink, N as SListItem, P as SMenu, F as SModal, I as SMoneyField, L as SNumber, R as SNumberField, z as SOption, B as SOptionGroup, V as SOrderedList, te as SPage, H as SParagraph, U as SPasswordField, W as SPopover, G as SPressButton, K as SProgress, q as SQueryContainer, J as SScrollBox, Y as SSearchField, X as SSection, Z as SSelect, Q as SSpinner, ne as SStack, re as SSwitch, ie as STable, ae as STableBody, oe as STableCell, $ as STableHeader, se as STableHeaderRow, ce as STableRow, le as SText, ue as STextArea, de as STextField, fe as SThumbnail, pe as STooltip, me as SUnorderedList, he as SUrlField, ge as componentTags, o as createWrapper };
|
|
3564
3567
|
|
|
3565
3568
|
//# sourceMappingURL=index.js.map
|