polaris-vue-elements 0.4.2 → 0.5.0
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 +31 -1
- package/README.md +64 -20
- package/package.json +16 -5
- package/tokens/tokens.css +1239 -0
- package/tokens/tokens.json +1455 -0
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,35 @@ major your app loads (`polaris-1.js`, `polaris-2.js`, …).
|
|
|
11
11
|
|
|
12
12
|
## [Unreleased]
|
|
13
13
|
|
|
14
|
+
## [0.5.0] - 2026-11-09
|
|
15
|
+
|
|
16
|
+
Still generated from `@shopify/polaris-types` 2.0.0. No changes to the components.
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- `polaris-vue-elements/tokens.css` and `polaris-vue-elements/tokens.json`: the Polaris
|
|
21
|
+
CSS variables (`--p-color-*`, `--p-space-*`, `--p-border-radius-*`, …) for your app's
|
|
22
|
+
own layout CSS, extracted from the Polaris runtime with the build hash removed from
|
|
23
|
+
the names. Unofficial: values follow the CDN, and a daily job opens a pull request
|
|
24
|
+
when they change. Includes the `admin-next` theme, which applies under the class the
|
|
25
|
+
runtime puts on `<html>`.
|
|
26
|
+
See [CSS variables](https://polaris-vue-elements.dev/guide/css-variables).
|
|
27
|
+
- Docs: a "Best practices" section on 50 component pages, before the example. Each is
|
|
28
|
+
our own summary of Shopify's guidance for that component, with Vue snippets, and links
|
|
29
|
+
to the full section on shopify.dev. Components Shopify publishes no guidance for have
|
|
30
|
+
none.
|
|
31
|
+
- Docs: the whole site in Vietnamese, Korean, Simplified Chinese, Japanese, German, French,
|
|
32
|
+
Spanish, Hindi and Brazilian Portuguese (`/vi/`, `/ko/`, `/zh/`, `/ja/`, `/de/`, `/fr/`,
|
|
33
|
+
`/es/`, `/hi/`, `/pt/`), including every component page and Shopify's prop and slot
|
|
34
|
+
descriptions, with hreflang links between the languages.
|
|
35
|
+
- Docs: a redesigned homepage, a frosted-glass nav bar, a back-to-top button and thin,
|
|
36
|
+
rounded scrollbars.
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
- `sideEffects` in `package.json` is now `["*.css"]` instead of `false`, so bundlers keep
|
|
41
|
+
`import 'polaris-vue-elements/tokens.css'`. JavaScript still tree-shakes as before.
|
|
42
|
+
|
|
14
43
|
## [0.4.2] - 2026-10-30
|
|
15
44
|
|
|
16
45
|
Still generated from `@shopify/polaris-types` 2.0.0. No changes to the components.
|
|
@@ -118,7 +147,8 @@ Initial release: typed Vue 3 wrappers for the 59 Shopify Polaris web components
|
|
|
118
147
|
`showOverlay()` / `hideOverlay()` / `toggleOverlay()`).
|
|
119
148
|
- ESM build with bundled type declarations; `vue` ^3.5 as a peer dependency.
|
|
120
149
|
|
|
121
|
-
[Unreleased]: https://github.com/HQCuong/polaris-vue/compare/v0.
|
|
150
|
+
[Unreleased]: https://github.com/HQCuong/polaris-vue/compare/v0.5.0...HEAD
|
|
151
|
+
[0.5.0]: https://github.com/HQCuong/polaris-vue/compare/v0.4.2...v0.5.0
|
|
122
152
|
[0.4.2]: https://github.com/HQCuong/polaris-vue/compare/v0.4.1...v0.4.2
|
|
123
153
|
[0.4.1]: https://github.com/HQCuong/polaris-vue/compare/v0.4.0...v0.4.1
|
|
124
154
|
[0.4.0]: https://github.com/HQCuong/polaris-vue/compare/v0.3.0...v0.4.0
|
package/README.md
CHANGED
|
@@ -1,15 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<sub>**English** | [Tiếng Việt](./i18n/vi/README.md) | [한국어](./i18n/ko/README.md) | [简体中文](./i18n/zh/README.md) | [日本語](./i18n/ja/README.md) | [Deutsch](./i18n/de/README.md) | [Français](./i18n/fr/README.md) | [Español](./i18n/es/README.md) | [हिन्दी](./i18n/hi/README.md) | [Português (Brasil)](./i18n/pt/README.md)</sub>
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<br>
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<a href="https://polaris-vue-elements.dev/">
|
|
8
|
+
<img src="https://polaris-vue-elements.dev/og.png" alt="polaris-vue-elements: typed Vue 3 wrappers for Shopify Polaris web components" width="720">
|
|
9
|
+
</a>
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
<br>
|
|
12
|
+
<br>
|
|
13
|
+
|
|
14
|
+
[](https://www.npmjs.com/package/polaris-vue-elements)
|
|
15
|
+
[](https://www.npmjs.com/package/polaris-vue-elements)
|
|
16
|
+
[](https://github.com/HQCuong/polaris-vue/actions/workflows/ci.yml)
|
|
17
|
+
[](./LICENSE)
|
|
18
|
+
|
|
19
|
+
**[Documentation](https://polaris-vue-elements.dev/)** ·
|
|
20
|
+
[Getting started](https://polaris-vue-elements.dev/guide/getting-started) ·
|
|
21
|
+
[Components](https://polaris-vue-elements.dev/components/) ·
|
|
22
|
+
[Embedded app guide](https://polaris-vue-elements.dev/guide/shopify-embedded-app) ·
|
|
23
|
+
[Changelog](./CHANGELOG.md)
|
|
24
|
+
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
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.
|
|
30
|
+
|
|
31
|
+
The Polaris runtime itself loads 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.
|
|
32
|
+
|
|
33
|
+
## Features
|
|
34
|
+
|
|
35
|
+
- **Typed props and events for all 62 components**, generated from Shopify's official Custom Elements Manifest (`@shopify/polaris-types`): union-typed props like `variant`, autocomplete in templates, typed `@click` / `@aftershow` listeners.
|
|
36
|
+
- **`v-model` on 17 form components** (`STextField`, `SCheckbox`, `SSelect`, `SChoiceList`, …), each mapped to its correct property/event pair.
|
|
37
|
+
- **Imperative overlay control.** `SModal` exposes a typed `$el` (`ModalElement`), so `modal.value?.$el.showOverlay()` type-checks, alongside Polaris's declarative `commandFor` / `command` pattern.
|
|
38
|
+
- **Degrades gracefully, never blocks.** Unknown props pass through via `$attrs`, slots are forwarded verbatim, and brand-new Polaris components can always be used as raw `s-*` tags. A stale wrapper means missing types for new features, never broken existing ones.
|
|
13
39
|
|
|
14
40
|
## Installation
|
|
15
41
|
|
|
@@ -21,15 +47,13 @@ Vue `^3.5` is a peer dependency.
|
|
|
21
47
|
|
|
22
48
|
### Runtime setup (required)
|
|
23
49
|
|
|
24
|
-
The wrappers are presentational only
|
|
50
|
+
The wrappers are presentational only. Your host app loads the Polaris runtime from Shopify's CDN and tells Vue that `s-*` tags are custom elements:
|
|
25
51
|
|
|
26
52
|
```html
|
|
27
53
|
<!-- index.html -->
|
|
28
54
|
<script src="https://cdn.shopify.com/shopifycloud/polaris-2.js"></script>
|
|
29
55
|
```
|
|
30
56
|
|
|
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
|
-
|
|
33
57
|
```ts
|
|
34
58
|
// vite.config.ts
|
|
35
59
|
vue({
|
|
@@ -41,7 +65,9 @@ vue({
|
|
|
41
65
|
})
|
|
42
66
|
```
|
|
43
67
|
|
|
44
|
-
|
|
68
|
+
> **Note:** `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).
|
|
69
|
+
|
|
70
|
+
## Quick start
|
|
45
71
|
|
|
46
72
|
```vue
|
|
47
73
|
<script setup lang="ts">
|
|
@@ -57,11 +83,21 @@ const name = ref('')
|
|
|
57
83
|
</template>
|
|
58
84
|
```
|
|
59
85
|
|
|
60
|
-
|
|
86
|
+
> **Tip:** 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).
|
|
87
|
+
|
|
88
|
+
## Documentation
|
|
89
|
+
|
|
90
|
+
Everything lives at **[polaris-vue-elements.dev](https://polaris-vue-elements.dev/)**:
|
|
61
91
|
|
|
62
|
-
|
|
92
|
+
- [Getting started](https://polaris-vue-elements.dev/guide/getting-started): setup, `v-model`, overlays and typed raw tags.
|
|
93
|
+
- [Build a Shopify embedded app with Vue 3](https://polaris-vue-elements.dev/guide/shopify-embedded-app): App Bridge, authenticated `fetch`, navigation and the save bar.
|
|
94
|
+
- [Known quirks](https://polaris-vue-elements.dev/guide/quirks): Polaris behaviors verified in a real browser.
|
|
95
|
+
- [CSS variables](https://polaris-vue-elements.dev/guide/css-variables): Polaris design tokens (`--p-color-*`, `--p-space-*`, …) as an importable `polaris-vue-elements/tokens.css` for your own layout CSS.
|
|
96
|
+
- [Component reference](https://polaris-vue-elements.dev/components/): props, events, slots, best practices and live examples for all 62 components.
|
|
63
97
|
|
|
64
|
-
|
|
98
|
+
The site's source is in [`docs/`](./docs); run it locally with `npm run docs:dev`.
|
|
99
|
+
|
|
100
|
+
## How it works
|
|
65
101
|
|
|
66
102
|
Everything derivable from Shopify's manifest is machine-generated; human judgment lives in one small file.
|
|
67
103
|
|
|
@@ -74,7 +110,10 @@ src/lib/runtime/ ← createWrapper: one generic factory for all 62 comp
|
|
|
74
110
|
src/lib/overrides.ts ← hand-written: v-model mappings only
|
|
75
111
|
```
|
|
76
112
|
|
|
77
|
-
|
|
113
|
+
Drift-guard tests make forgetting impossible: CI fails if generated code is stale, if a manifest component lacks a wrapper, or if a new form-like component is missing a v-model override. A scheduled workflow ([`sync-polaris.yml`](.github/workflows/sync-polaris.yml)) opens a sync PR automatically when a new `@shopify/polaris-types` is published.
|
|
114
|
+
|
|
115
|
+
<details>
|
|
116
|
+
<summary><strong>Updating to a new Polaris version by hand</strong></summary>
|
|
78
117
|
|
|
79
118
|
```sh
|
|
80
119
|
npm update @shopify/polaris-types
|
|
@@ -83,7 +122,7 @@ npm run docs:generate # regenerate component reference docs
|
|
|
83
122
|
git diff # review, then note API changes in CHANGELOG.md
|
|
84
123
|
```
|
|
85
124
|
|
|
86
|
-
|
|
125
|
+
</details>
|
|
87
126
|
|
|
88
127
|
## Development
|
|
89
128
|
|
|
@@ -101,16 +140,21 @@ npm run build:lib # build the publishable package into dist/
|
|
|
101
140
|
|
|
102
141
|
## Contributing
|
|
103
142
|
|
|
104
|
-
See [CONTRIBUTING.md](./CONTRIBUTING.md) for setup, ground rules and the pre-PR checklist.
|
|
143
|
+
Bug reports, docs fixes and pull requests are welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md) for setup, ground rules and the pre-PR checklist, and the [Code of Conduct](./CODE_OF_CONDUCT.md). To report a vulnerability, see [SECURITY.md](./SECURITY.md).
|
|
105
144
|
|
|
106
145
|
## Releasing
|
|
107
146
|
|
|
108
|
-
Releases are cut from `main` by pushing a version tag
|
|
147
|
+
Releases are cut from `main` by pushing a version tag. [`release.yml`](.github/workflows/release.yml) does the rest: checks, `npm publish` with provenance via npm Trusted Publishing, and a GitHub Release whose notes come from `CHANGELOG.md`.
|
|
148
|
+
|
|
149
|
+
<details>
|
|
150
|
+
<summary><strong>Release steps (maintainers)</strong></summary>
|
|
109
151
|
|
|
110
152
|
1. In [`CHANGELOG.md`](./CHANGELOG.md), move the `## [Unreleased]` entries under a new `## [x.y.z] - YYYY-MM-DD` heading and update the compare links at the bottom. The polaris-types sync PRs record new/removed components there automatically; add prop, slot and icon changes by hand (removals are breaking).
|
|
111
153
|
2. `npm version x.y.z --no-git-tag-version`, commit both files, and push to `main`.
|
|
112
154
|
3. `git tag vx.y.z && git push origin vx.y.z`. Tags with a pre-release suffix (e.g. `v0.3.0-rc.0`) publish under the `next` dist-tag.
|
|
113
155
|
|
|
156
|
+
</details>
|
|
157
|
+
|
|
114
158
|
## License
|
|
115
159
|
|
|
116
|
-
[MIT](./LICENSE)
|
|
160
|
+
[MIT](./LICENSE). Not affiliated with or endorsed by Shopify.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polaris-vue-elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Typed Vue 3 components for Shopify Polaris web components — build Shopify app UIs (App Home) in Vue with props, events and v-model.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://polaris-vue-elements.dev",
|
|
@@ -32,13 +32,19 @@
|
|
|
32
32
|
},
|
|
33
33
|
"./elements": {
|
|
34
34
|
"types": "./dist/generated/elements.d.ts"
|
|
35
|
-
}
|
|
35
|
+
},
|
|
36
|
+
"./tokens.css": "./tokens/tokens.css",
|
|
37
|
+
"./tokens.json": "./tokens/tokens.json"
|
|
36
38
|
},
|
|
37
39
|
"files": [
|
|
38
40
|
"dist",
|
|
41
|
+
"tokens/tokens.css",
|
|
42
|
+
"tokens/tokens.json",
|
|
39
43
|
"CHANGELOG.md"
|
|
40
44
|
],
|
|
41
|
-
"sideEffects":
|
|
45
|
+
"sideEffects": [
|
|
46
|
+
"*.css"
|
|
47
|
+
],
|
|
42
48
|
"simple-git-hooks": {
|
|
43
49
|
"pre-push": "npm run check"
|
|
44
50
|
},
|
|
@@ -78,13 +84,14 @@
|
|
|
78
84
|
"@vue/tsconfig": "^0.9.1",
|
|
79
85
|
"eslint": "^10.7.0",
|
|
80
86
|
"eslint-config-prettier": "^10.1.8",
|
|
81
|
-
"eslint-plugin-oxlint": "~1.
|
|
87
|
+
"eslint-plugin-oxlint": "~1.90.0",
|
|
82
88
|
"eslint-plugin-vue": "~10.12.0",
|
|
83
89
|
"jiti": "^2.7.0",
|
|
84
90
|
"jsdom": "^30.1.3",
|
|
85
91
|
"npm-run-all2": "^9.0.2",
|
|
86
92
|
"oxfmt": "^0.75.0",
|
|
87
|
-
"oxlint": "~1.
|
|
93
|
+
"oxlint": "~1.90.0",
|
|
94
|
+
"postcss": "^8.5.32",
|
|
88
95
|
"simple-git-hooks": "^2.13.1",
|
|
89
96
|
"typescript": "~6.0.0",
|
|
90
97
|
"vite": "^8.1.5",
|
|
@@ -108,6 +115,10 @@
|
|
|
108
115
|
"overrides": {
|
|
109
116
|
"vitepress": {
|
|
110
117
|
"vite": "^6.4.5"
|
|
118
|
+
},
|
|
119
|
+
"minimatch@>=7.0.0 <11.0.1": "^11.0.1",
|
|
120
|
+
"js-beautify": {
|
|
121
|
+
"glob": "^14.0.2"
|
|
111
122
|
}
|
|
112
123
|
}
|
|
113
124
|
}
|