@thinkpixellab-public/px-vue 4.0.7 → 4.0.9

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.
@@ -10,6 +10,7 @@
10
10
 
11
11
  <script>
12
12
  export default {
13
+ emits: ['update:checked', 'checked', 'unchecked'],
13
14
  props: {
14
15
  /**
15
16
  * The value of the checked property.
@@ -3,8 +3,8 @@
3
3
 
4
4
  Keeps a child element contained within boundaries.
5
5
 
6
- <px-contain #default="{width, height, left: }" :aspect="16/9" :round="true" :to-px="true">
7
- <div :style="{position: 'absolute', left: left top: top width: width height: height}" />
6
+ <px-contain #default="{width, height, left, top }" :aspect="16/9" :round="true" :to-px="true">
7
+ <div :style="{position: 'absolute', left: left top: top, width: width, height: height}" />
8
8
  </px-contain>
9
9
 
10
10
  -->
@@ -1,72 +1,31 @@
1
1
  <!--
2
- #VUE3 Todo
3
- -->
4
-
5
- <!--
6
- Creates a custom svg-based qr code.
2
+ Creates a custom qr code.
7
3
 
8
4
  Usage:
9
5
  <px-qr-code :content="http://thinkpixellab.com" />
10
6
 
11
7
  -->
12
8
  <template>
13
- <div :class="bem()" v-html="svg"></div>
9
+ <qrcode-vue
10
+ :class="bem()"
11
+ v-if="content"
12
+ :value="content"
13
+ :size="size"
14
+ role="img"
15
+ :aria-label="label"
16
+ ></qrcode-vue>
14
17
  </template>
15
18
 
16
19
  <script>
17
- import * as qrcode from 'qrcode'
18
- import PxBaseResize from '../bases/PxBaseResize.vue';
20
+ import QrcodeVue from 'qrcode.vue';
19
21
 
20
22
  export default {
21
23
  name: 'px-qr-code',
22
- mixins: [PxBaseResize],
24
+ components: { QrcodeVue },
23
25
  props: {
24
26
  content: { type: String, default: 'Hello' },
25
- foreground: { type: String, default: '#000000' },
26
- background: { type: String, default: '#FFFFFF' },
27
- padding: { type: Number, default: 0 },
28
- ecl: { type: String, default: 'L' },
29
- },
30
- data() {
31
- return { size: 0, svg: '' };
32
- },
33
- watch: {
34
- content() {
35
- this.updateSvg();
36
- },
37
- foreground() {
38
- this.updateSvg();
39
- },
40
- background() {
41
- this.updateSvg();
42
- },
43
- padding() {
44
- this.updateSvg();
45
- },
46
- },
47
- mounted() {
48
- this.updateSvg();
49
- },
50
- methods: {
51
- updateSvg() {
52
- qrcode.toString(
53
- this.content,
54
- {
55
- type: 'svg',
56
- margin: this.padding,
57
- color: {
58
- dark: this.foreground,
59
- light: this.background,
60
- },
61
- },
62
- (err, str) => {
63
- if (err) {
64
- console.warn('Error creating QR Code. \n' + err);
65
- }
66
- this.svg = str;
67
- }
68
- );
69
- },
27
+ label: { type: String },
28
+ size: { type: Number, default: 400 },
70
29
  },
71
30
  };
72
31
  </script>
@@ -75,8 +34,12 @@ export default {
75
34
  .px-qr-code {
76
35
  aspect-ratio: 1;
77
36
  width: 256px;
78
- svg {
79
- width: 100%;
37
+ canvas {
38
+ position: absolute;
39
+ top: 0;
40
+ left: 0;
41
+ width: 100% !important;
42
+ height: 100% !important;
80
43
  }
81
44
  }
82
45
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkpixellab-public/px-vue",
3
- "version": "4.0.7",
3
+ "version": "4.0.9",
4
4
  "description": "General purpose Vue components and helpers that can be used across projects.",
5
5
  "author": "Pixel Lab",
6
6
  "license": "MIT",
@@ -20,7 +20,7 @@
20
20
  "@thinkpixellab-public/vue-resize-directive": "^1.2.2",
21
21
  "body-scroll-lock": "^4.0.0-beta.0",
22
22
  "mitt": "^3.0.0",
23
- "qrcode": "^1.5.3",
23
+ "qrcode.vue": "^3.4.0",
24
24
  "throttle-debounce": "^5.0.0",
25
25
  "vue": "^3.3.4",
26
26
  "vue-inline-svg": "^3.1.0"
@@ -1,5 +1,5 @@
1
1
  export default val => {
2
- if (val && !process.server) {
2
+ if (val && typeof document !== 'undefined') {
3
3
  val = val.replace(/<\/p>/g, '</p> ');
4
4
  val = val.replace(/<\/li>/g, '</li> ');
5
5
  val = val.replace(/<\/div>/g, '</div> ');
@@ -10,8 +10,7 @@ by name, default replacements collection that converts the color black to `curre
10
10
  properties for customizing stroke width, offset and spacing.
11
11
 
12
12
  To make named app icons available, create a plugin in the project that calls
13
- `app.provide('PxIcon.icons', appIcons)` where `appIcons` is a collection of icons like `{ iconOne:
14
- srcOne, iconTwo: srcTwo }`.
13
+ `app.provide('PxIcon.icons', appIcons)` where `appIcons` is a collection of icons like `{ iconOne: srcOne, iconTwo: srcTwo }`.
15
14
 
16
15
  PxVue contains the full set of [feather icons](https://feathericons.com/) and a helper for making
17
16
  those available by name within the application. See the plugin reference below.
@@ -20,8 +19,6 @@ those available by name within the application. See the plugin reference below.
20
19
 
21
20
  <Controls of={PxIconStories.Basic} />
22
21
 
23
- ### Nuxt 3 Plugin Example
24
-
25
22
  ```js
26
23
  // px-vue feather icons helper
27
24
  import getFeatherIcons from '@thinkpixellab-public/px-vue/utils/getFeatherIcons.js';
@@ -30,15 +27,14 @@ export default defineNuxtPlugin(nuxtApp => {
30
27
  const vueApp = nuxtApp.vueApp;
31
28
 
32
29
  // search for icons in the @/assets/feather folder
33
- const icons = Object.values(import.meta.globEager('@/assets/feather/*.svg')).reduce(
34
- (obj, value) => {
35
- const url = value.default;
36
- const name = url.match(/([^\/]+)(?=\.\w+$)/)[0];
37
- obj[name] = url;
38
- return obj;
39
- },
40
- {}
41
- );
30
+ const icons = Object.values(
31
+ import.meta.globEager('@thinkpixellab-public/px-vue/assets/feather/*.svg')
32
+ ).reduce((obj, value) => {
33
+ const url = value.default;
34
+ const name = url.match(/([^\/]+)(?=\.\w+$)/)[0];
35
+ obj[name] = url;
36
+ return obj;
37
+ }, {});
42
38
 
43
39
  vueApp.provide('PxIcon.icons', {
44
40
  // local icons