@public-ui/hydrate 3.0.2-f97556ada8a20e9abe2dbb519562bad234f7191b.0 → 3.0.2-rc.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/README.md CHANGED
@@ -19,9 +19,9 @@ Provide an adapter for Server Side Rendering of KoliBri components.
19
19
  You can install the adapter with `npm`, `pnpm` or `yarn`:
20
20
 
21
21
  ```bash
22
- npm i -g @public-ui/hydrate
23
- pnpm i -g @public-ui/hydrate
24
- yarn add -g @public-ui/hydrate
22
+ npm i @public-ui/hydrate
23
+ pnpm i @public-ui/hydrate
24
+ yarn add @public-ui/hydrate
25
25
  ```
26
26
 
27
27
  ## Usage
@@ -35,3 +35,5 @@ import { renderToString } from '@public-ui/hydrate';
35
35
  const inputHtml = `<kol-button _label="Hello World"_></kol-button>`;
36
36
  const { html } = await renderToString(inputHtml);
37
37
  ```
38
+
39
+ Refer to the [default theme README](../../themes/default/README.md) for information on customizing the output.
package/dist/index.js CHANGED
@@ -3832,6 +3832,10 @@ const validateAdjustHeight = (component, value) => {
3832
3832
  watchBoolean(component, '_adjustHeight', value);
3833
3833
  };
3834
3834
 
3835
+ const validateAlt = (component, value, options = {}) => {
3836
+ watchString(component, '_alt', value, options);
3837
+ };
3838
+
3835
3839
  const validateAlignment = (component, propName, value) => {
3836
3840
  watchValidator(component, propName, (value) => typeof value === 'string' && alignPropTypeOptions.includes(value), new Set(alignPropTypeOptions), value, {
3837
3841
  defaultValue: 'top',
@@ -4198,6 +4202,14 @@ const validateImageSource = (component, value, options) => {
4198
4202
  watchString(component, '_src', value, options);
4199
4203
  };
4200
4204
 
4205
+ const validateImageSizes = (component, value, options = {}) => {
4206
+ watchString(component, '_sizes', value, options);
4207
+ };
4208
+
4209
+ const validateImageSrcset = (component, value, options = {}) => {
4210
+ watchString(component, '_srcset', value, options);
4211
+ };
4212
+
4201
4213
  const validateIndeterminate = (component, value) => {
4202
4214
  watchBoolean(component, '_indeterminate', value);
4203
4215
  };
@@ -5134,13 +5146,28 @@ const AlertIcon = ({ type, label }) => {
5134
5146
  }
5135
5147
  };
5136
5148
 
5149
+ const vibrateOnError = () => {
5150
+ if (typeof navigator === 'undefined' || typeof navigator.vibrate !== 'function') {
5151
+ return;
5152
+ }
5153
+ const ua = navigator.userActivation;
5154
+ const hasGesture = (ua === null || ua === void 0 ? void 0 : ua.isActive) || (ua === null || ua === void 0 ? void 0 : ua.hasBeenActive);
5155
+ if (!hasGesture) {
5156
+ return;
5157
+ }
5158
+ if (!matchMedia('(any-pointer: coarse)').matches) {
5159
+ return;
5160
+ }
5161
+ try {
5162
+ navigator.vibrate([100, 75, 100, 75, 100]);
5163
+ }
5164
+ catch (_a) {
5165
+ }
5166
+ };
5137
5167
  const KolAlertFc = (props, children) => {
5138
- var _a, _b;
5139
5168
  const { class: classNames = {}, alert = false, hasCloser = false, label, level = 0, type = 'default', variant = 'msg', onAlertTimeout, onCloserClick } = props, other = __rest(props, ["class", "alert", "hasCloser", "label", "level", "type", "variant", "onAlertTimeout", "onCloserClick"]);
5140
5169
  if (alert) {
5141
- if ((_a = navigator.userActivation) === null || _a === void 0 ? void 0 : _a.hasBeenActive) {
5142
- (_b = navigator === null || navigator === void 0 ? void 0 : navigator.vibrate) === null || _b === void 0 ? void 0 : _b.call(navigator, [100, 75, 100, 75, 100]);
5143
- }
5170
+ vibrateOnError();
5144
5171
  setTimeout(() => {
5145
5172
  onAlertTimeout === null || onAlertTimeout === void 0 ? void 0 : onAlertTimeout();
5146
5173
  }, 10000);
@@ -5205,7 +5232,7 @@ class KolAlertWc {
5205
5232
  onCloserClick: this.close,
5206
5233
  onAlertTimeout: this.handleAlertTimeout,
5207
5234
  };
5208
- return (hAsync(KolAlertFc, Object.assign({ key: '9038051f21b86a9c83c8ac5619e723dff5ebcbeb' }, props), hAsync("slot", { key: 'cfd116176ab783db5232d9d5520f8ae890ca44db' })));
5235
+ return (hAsync(KolAlertFc, Object.assign({ key: '2b0d74465270eef8d8d6f3da8c04377f862e8630' }, props), hAsync("slot", { key: '55e8ad62be763c26af16813e5ebfac2ce1f63b54' })));
5209
5236
  }
5210
5237
  validateAlert(value) {
5211
5238
  watchBoolean(this, '_alert', value);
@@ -18330,15 +18357,13 @@ class KolImage {
18330
18357
  };
18331
18358
  }
18332
18359
  validateAlt(value) {
18333
- watchString(this, '_alt', value, {
18334
- required: true,
18335
- });
18360
+ validateAlt(this, value, { required: true });
18336
18361
  }
18337
18362
  validateLoading(value) {
18338
18363
  validateLoading(this, value);
18339
18364
  }
18340
18365
  validateSizes(value) {
18341
- watchString(this, '_sizes', value);
18366
+ validateImageSizes(this, value);
18342
18367
  }
18343
18368
  validateSrc(value) {
18344
18369
  validateImageSource(this, value, {
@@ -18346,7 +18371,7 @@ class KolImage {
18346
18371
  });
18347
18372
  }
18348
18373
  validateSrcset(value) {
18349
- watchString(this, '_srcset', value);
18374
+ validateImageSrcset(this, value);
18350
18375
  }
18351
18376
  componentWillLoad() {
18352
18377
  this.validateAlt(this._alt);
@@ -18356,7 +18381,7 @@ class KolImage {
18356
18381
  this.validateSrcset(this._srcset);
18357
18382
  }
18358
18383
  render() {
18359
- return (hAsync("img", { key: '23837493ec11632608a497a0319b945b91cadb6d', class: "kol-image", alt: this.state._alt, loading: this.state._loading, sizes: this.state._sizes, src: this.state._src, srcset: this.state._srcset }));
18384
+ return (hAsync("img", { key: 'cca1e1b65e9aab11b4c15bea394d6c54ead1a123', class: "kol-image", alt: this.state._alt, loading: this.state._loading, sizes: this.state._sizes, src: this.state._src, srcset: this.state._srcset }));
18360
18385
  }
18361
18386
  static get watchers() { return {
18362
18387
  "_alt": ["validateAlt"],
package/dist/index.mjs CHANGED
@@ -3828,6 +3828,10 @@ const validateAdjustHeight = (component, value) => {
3828
3828
  watchBoolean(component, '_adjustHeight', value);
3829
3829
  };
3830
3830
 
3831
+ const validateAlt = (component, value, options = {}) => {
3832
+ watchString(component, '_alt', value, options);
3833
+ };
3834
+
3831
3835
  const validateAlignment = (component, propName, value) => {
3832
3836
  watchValidator(component, propName, (value) => typeof value === 'string' && alignPropTypeOptions.includes(value), new Set(alignPropTypeOptions), value, {
3833
3837
  defaultValue: 'top',
@@ -4194,6 +4198,14 @@ const validateImageSource = (component, value, options) => {
4194
4198
  watchString(component, '_src', value, options);
4195
4199
  };
4196
4200
 
4201
+ const validateImageSizes = (component, value, options = {}) => {
4202
+ watchString(component, '_sizes', value, options);
4203
+ };
4204
+
4205
+ const validateImageSrcset = (component, value, options = {}) => {
4206
+ watchString(component, '_srcset', value, options);
4207
+ };
4208
+
4197
4209
  const validateIndeterminate = (component, value) => {
4198
4210
  watchBoolean(component, '_indeterminate', value);
4199
4211
  };
@@ -5130,13 +5142,28 @@ const AlertIcon = ({ type, label }) => {
5130
5142
  }
5131
5143
  };
5132
5144
 
5145
+ const vibrateOnError = () => {
5146
+ if (typeof navigator === 'undefined' || typeof navigator.vibrate !== 'function') {
5147
+ return;
5148
+ }
5149
+ const ua = navigator.userActivation;
5150
+ const hasGesture = (ua === null || ua === void 0 ? void 0 : ua.isActive) || (ua === null || ua === void 0 ? void 0 : ua.hasBeenActive);
5151
+ if (!hasGesture) {
5152
+ return;
5153
+ }
5154
+ if (!matchMedia('(any-pointer: coarse)').matches) {
5155
+ return;
5156
+ }
5157
+ try {
5158
+ navigator.vibrate([100, 75, 100, 75, 100]);
5159
+ }
5160
+ catch (_a) {
5161
+ }
5162
+ };
5133
5163
  const KolAlertFc = (props, children) => {
5134
- var _a, _b;
5135
5164
  const { class: classNames = {}, alert = false, hasCloser = false, label, level = 0, type = 'default', variant = 'msg', onAlertTimeout, onCloserClick } = props, other = __rest(props, ["class", "alert", "hasCloser", "label", "level", "type", "variant", "onAlertTimeout", "onCloserClick"]);
5136
5165
  if (alert) {
5137
- if ((_a = navigator.userActivation) === null || _a === void 0 ? void 0 : _a.hasBeenActive) {
5138
- (_b = navigator === null || navigator === void 0 ? void 0 : navigator.vibrate) === null || _b === void 0 ? void 0 : _b.call(navigator, [100, 75, 100, 75, 100]);
5139
- }
5166
+ vibrateOnError();
5140
5167
  setTimeout(() => {
5141
5168
  onAlertTimeout === null || onAlertTimeout === void 0 ? void 0 : onAlertTimeout();
5142
5169
  }, 10000);
@@ -5201,7 +5228,7 @@ class KolAlertWc {
5201
5228
  onCloserClick: this.close,
5202
5229
  onAlertTimeout: this.handleAlertTimeout,
5203
5230
  };
5204
- return (hAsync(KolAlertFc, Object.assign({ key: '9038051f21b86a9c83c8ac5619e723dff5ebcbeb' }, props), hAsync("slot", { key: 'cfd116176ab783db5232d9d5520f8ae890ca44db' })));
5231
+ return (hAsync(KolAlertFc, Object.assign({ key: '2b0d74465270eef8d8d6f3da8c04377f862e8630' }, props), hAsync("slot", { key: '55e8ad62be763c26af16813e5ebfac2ce1f63b54' })));
5205
5232
  }
5206
5233
  validateAlert(value) {
5207
5234
  watchBoolean(this, '_alert', value);
@@ -18326,15 +18353,13 @@ class KolImage {
18326
18353
  };
18327
18354
  }
18328
18355
  validateAlt(value) {
18329
- watchString(this, '_alt', value, {
18330
- required: true,
18331
- });
18356
+ validateAlt(this, value, { required: true });
18332
18357
  }
18333
18358
  validateLoading(value) {
18334
18359
  validateLoading(this, value);
18335
18360
  }
18336
18361
  validateSizes(value) {
18337
- watchString(this, '_sizes', value);
18362
+ validateImageSizes(this, value);
18338
18363
  }
18339
18364
  validateSrc(value) {
18340
18365
  validateImageSource(this, value, {
@@ -18342,7 +18367,7 @@ class KolImage {
18342
18367
  });
18343
18368
  }
18344
18369
  validateSrcset(value) {
18345
- watchString(this, '_srcset', value);
18370
+ validateImageSrcset(this, value);
18346
18371
  }
18347
18372
  componentWillLoad() {
18348
18373
  this.validateAlt(this._alt);
@@ -18352,7 +18377,7 @@ class KolImage {
18352
18377
  this.validateSrcset(this._srcset);
18353
18378
  }
18354
18379
  render() {
18355
- return (hAsync("img", { key: '23837493ec11632608a497a0319b945b91cadb6d', class: "kol-image", alt: this.state._alt, loading: this.state._loading, sizes: this.state._sizes, src: this.state._src, srcset: this.state._srcset }));
18380
+ return (hAsync("img", { key: 'cca1e1b65e9aab11b4c15bea394d6c54ead1a123', class: "kol-image", alt: this.state._alt, loading: this.state._loading, sizes: this.state._sizes, src: this.state._src, srcset: this.state._srcset }));
18356
18381
  }
18357
18382
  static get watchers() { return {
18358
18383
  "_alt": ["validateAlt"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@public-ui/hydrate",
3
- "version": "3.0.2-f97556ada8a20e9abe2dbb519562bad234f7191b.0",
3
+ "version": "3.0.2-rc.0",
4
4
  "license": "EUPL-1.2",
5
5
  "homepage": "https://public-ui.github.io",
6
6
  "repository": {
@@ -46,10 +46,10 @@
46
46
  ],
47
47
  "devDependencies": {
48
48
  "rimraf": "6.0.1",
49
- "@public-ui/components": "3.0.2-f97556ada8a20e9abe2dbb519562bad234f7191b.0"
49
+ "@public-ui/components": "3.0.2-rc.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "@public-ui/components": "3.0.2-f97556ada8a20e9abe2dbb519562bad234f7191b.0"
52
+ "@public-ui/components": "3.0.2-rc.0"
53
53
  },
54
54
  "sideEffects": false,
55
55
  "type": "commonjs",