smoothly 0.1.86 → 0.1.90

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.
Files changed (102) hide show
  1. package/dist/cjs/GoogleFont-47aed323.js +21 -0
  2. package/dist/cjs/{generate-a6821b82.js → generate-f9a36f25.js} +1 -1
  3. package/dist/cjs/{index-fc82954f.js → index-ac32385c.js} +230 -184
  4. package/dist/cjs/{index-de5d1ee1.js → index-b5fcdcf9.js} +2 -0
  5. package/dist/cjs/index-bc3845e8.js +1670 -0
  6. package/dist/cjs/index.cjs.js +8 -1
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/smoothly-accordion_47.cjs.entry.js +1166 -19144
  9. package/dist/cjs/smoothly-calendar.cjs.entry.js +40 -12
  10. package/dist/cjs/smoothly-dialog.cjs.entry.js +2 -1
  11. package/dist/cjs/smoothly-display-amount.cjs.entry.js +1 -1
  12. package/dist/cjs/smoothly-display-demo.cjs.entry.js +2 -1
  13. package/dist/cjs/smoothly-display.cjs.entry.js +2 -1
  14. package/dist/cjs/smoothly-frame.cjs.entry.js +2 -1
  15. package/dist/cjs/smoothly-google-font.cjs.entry.js +17 -0
  16. package/dist/cjs/smoothly-input-date-range.cjs.entry.js +9 -10
  17. package/dist/cjs/smoothly-input-date.cjs.entry.js +5 -1
  18. package/dist/cjs/smoothly-input-month.cjs.entry.js +2 -2
  19. package/dist/cjs/smoothly-input.cjs.entry.js +20 -13
  20. package/dist/cjs/smoothly-select-demo.cjs.entry.js +3 -2
  21. package/dist/cjs/smoothly-trigger-sink.cjs.entry.js +2 -1
  22. package/dist/cjs/smoothly-trigger-source.cjs.entry.js +2 -1
  23. package/dist/cjs/smoothly.cjs.js +1 -1
  24. package/dist/collection/collection-manifest.json +1 -0
  25. package/dist/collection/components/calendar/index.js +80 -11
  26. package/dist/collection/components/display/index.js +1 -1
  27. package/dist/collection/components/google-font/index.js +33 -0
  28. package/dist/collection/components/input/index.js +20 -13
  29. package/dist/collection/components/input/style.css +1 -0
  30. package/dist/collection/components/input-date/index.js +12 -1
  31. package/dist/collection/components/input-date-range/index.js +14 -15
  32. package/dist/collection/components/select-demo/index.js +3 -2
  33. package/dist/collection/index.js +1 -1
  34. package/dist/collection/model/GoogleFont.js +19 -0
  35. package/dist/collection/model/index.js +1 -0
  36. package/dist/custom-elements/index.d.ts +6 -0
  37. package/dist/custom-elements/index.js +1367 -19513
  38. package/dist/esm/GoogleFont-31de060f.js +21 -0
  39. package/dist/esm/{generate-776b3b0f.js → generate-50b98474.js} +1 -1
  40. package/dist/esm/index-37a67c97.js +1668 -0
  41. package/dist/esm/{index-68492ed9.js → index-53434aca.js} +2 -0
  42. package/dist/{smoothly/index-a28d88cf.js → esm/index-a5a08f46.js} +230 -184
  43. package/dist/esm/index.js +2 -1
  44. package/dist/esm/loader.js +1 -1
  45. package/dist/esm/smoothly-accordion_47.entry.js +1166 -19144
  46. package/dist/esm/smoothly-calendar.entry.js +40 -12
  47. package/dist/esm/smoothly-dialog.entry.js +2 -1
  48. package/dist/esm/smoothly-display-amount.entry.js +1 -1
  49. package/dist/esm/smoothly-display-demo.entry.js +2 -1
  50. package/dist/esm/smoothly-display.entry.js +2 -1
  51. package/dist/esm/smoothly-frame.entry.js +2 -1
  52. package/dist/esm/smoothly-google-font.entry.js +13 -0
  53. package/dist/esm/smoothly-input-date-range.entry.js +9 -10
  54. package/dist/esm/smoothly-input-date.entry.js +5 -1
  55. package/dist/esm/smoothly-input-month.entry.js +2 -2
  56. package/dist/esm/smoothly-input.entry.js +20 -13
  57. package/dist/esm/smoothly-select-demo.entry.js +3 -2
  58. package/dist/esm/smoothly-trigger-sink.entry.js +2 -1
  59. package/dist/esm/smoothly-trigger-source.entry.js +2 -1
  60. package/dist/esm/smoothly.js +1 -1
  61. package/dist/smoothly/GoogleFont-31de060f.js +21 -0
  62. package/dist/smoothly/{generate-776b3b0f.js → generate-50b98474.js} +1 -1
  63. package/dist/smoothly/index-37a67c97.js +1668 -0
  64. package/dist/smoothly/{index-68492ed9.js → index-53434aca.js} +2 -0
  65. package/dist/{esm/index-a28d88cf.js → smoothly/index-a5a08f46.js} +230 -184
  66. package/dist/smoothly/index.esm.js +2 -1
  67. package/dist/smoothly/p-07653599.entry.js +1 -0
  68. package/dist/smoothly/p-2191d2d2.entry.js +1 -0
  69. package/dist/smoothly/p-82f56327.js +1 -0
  70. package/dist/smoothly/p-d2cfda26.entry.js +1 -0
  71. package/dist/smoothly/p-f6cbbcf3.entry.js +1 -0
  72. package/dist/smoothly/smoothly-calendar.entry.js +40 -12
  73. package/dist/smoothly/smoothly-dialog.entry.js +2 -1
  74. package/dist/smoothly/smoothly-display-amount.entry.js +1 -1
  75. package/dist/smoothly/smoothly-display-demo.entry.js +2 -1
  76. package/dist/smoothly/smoothly-display.entry.js +2 -1
  77. package/dist/smoothly/smoothly-frame.entry.js +2 -1
  78. package/dist/smoothly/smoothly-google-font.entry.js +13 -0
  79. package/dist/smoothly/smoothly-input-date-range.entry.js +9 -10
  80. package/dist/smoothly/smoothly-input-date.entry.js +5 -1
  81. package/dist/smoothly/smoothly-input-month.entry.js +2 -2
  82. package/dist/smoothly/smoothly-input.entry.js +20 -13
  83. package/dist/smoothly/smoothly-select-demo.entry.js +3 -2
  84. package/dist/smoothly/smoothly-trigger-sink.entry.js +2 -1
  85. package/dist/smoothly/smoothly-trigger-source.entry.js +2 -1
  86. package/dist/smoothly/smoothly.esm.js +1 -1
  87. package/dist/types/components/calendar/index.d.ts +6 -1
  88. package/dist/types/components/google-font/index.d.ts +5 -0
  89. package/dist/types/components/input/index.d.ts +1 -0
  90. package/dist/types/components/input-date/index.d.ts +1 -0
  91. package/dist/types/components/input-date-range/index.d.ts +2 -2
  92. package/dist/types/components.d.ts +19 -1
  93. package/dist/types/index.d.ts +1 -1
  94. package/dist/types/model/GoogleFont.d.ts +6 -0
  95. package/dist/types/model/index.d.ts +1 -0
  96. package/package.json +3 -3
  97. package/dist/cjs/index-42db74b3.js +0 -19931
  98. package/dist/esm/index-36a04e8c.js +0 -19929
  99. package/dist/smoothly/index-36a04e8c.js +0 -19929
  100. package/dist/smoothly/p-09d633f8.entry.js +0 -1
  101. package/dist/smoothly/p-1a81597b.entry.js +0 -1
  102. package/dist/smoothly/p-375a8d94.entry.js +0 -1
@@ -1,4 +1,5 @@
1
1
  import { Component, Event, h, Host, Method, Prop, Watch } from "@stencil/core";
2
+ import { Language, Locale } from "isoly";
2
3
  import { Action, get, StateEditor } from "tidily";
3
4
  export class SmoothlyInput {
4
5
  constructor() {
@@ -17,27 +18,30 @@ export class SmoothlyInput {
17
18
  result = get("price", this.currency);
18
19
  break;
19
20
  default:
20
- result = get(this.type);
21
+ result = get(this.type, getLocale());
21
22
  break;
22
23
  }
23
24
  return result || get("text");
24
25
  }
26
+ newState(state) {
27
+ const formatter = this.formatter;
28
+ return formatter.format(StateEditor.copy(formatter.unformat(StateEditor.copy(state))));
29
+ }
25
30
  valueWatcher(value, before) {
26
31
  if (this.lastValue != value) {
27
32
  this.lastValue = value;
28
- this.state = Object.assign(Object.assign({}, this.state), { value: this.formatter.format(StateEditor.copy(this.formatter.unformat(StateEditor.copy({ value, selection: this.state.selection })))).value });
33
+ this.state = Object.assign(Object.assign({}, this.state), { value: this.newState({ value: this.formatter.toString(value), selection: this.state.selection }).value });
29
34
  }
30
35
  if (value != before)
31
36
  this.smoothlyChanged.emit({ name: this.name, value });
32
37
  }
33
38
  componentWillLoad() {
34
- const formatter = this.formatter;
35
- const value = formatter.toString(this.value) || "";
39
+ const value = this.formatter.toString(this.value) || "";
36
40
  const start = value.length;
37
- this.state = formatter.format(StateEditor.copy(formatter.unformat(StateEditor.copy({
41
+ this.state = this.newState({
38
42
  value,
39
43
  selection: { start, end: start, direction: "none" },
40
- }))));
44
+ });
41
45
  }
42
46
  componentDidRender() {
43
47
  if (this.keepFocusOnReRender) {
@@ -49,8 +53,7 @@ export class SmoothlyInput {
49
53
  this.keepFocusOnReRender = keepFocus;
50
54
  }
51
55
  async setSelectionRange(start, end, direction) {
52
- const formatter = this.formatter;
53
- this.state = formatter.format(StateEditor.copy(formatter.unformat(StateEditor.copy(Object.assign(Object.assign({}, this.state), { selection: { start, end, direction: direction != undefined ? direction : this.state.selection.direction } })))));
56
+ this.state = this.newState(Object.assign(Object.assign({}, this.state), { selection: { start, end, direction: direction != undefined ? direction : this.state.selection.direction } }));
54
57
  const after = this.formatter.format(StateEditor.copy(this.formatter.unformat(StateEditor.copy(Object.assign({}, this.state)))));
55
58
  this.updateBackend(after, this.inputElement);
56
59
  }
@@ -67,7 +70,7 @@ export class SmoothlyInput {
67
70
  end: backend.selectionEnd != undefined ? backend.selectionEnd : backend.value.length,
68
71
  direction: backend.selectionDirection ? backend.selectionDirection : "none",
69
72
  } });
70
- const after = this.formatter.format(StateEditor.copy(this.formatter.unformat(StateEditor.copy(Object.assign({}, this.state)))));
73
+ const after = this.newState(Object.assign({}, this.state));
71
74
  this.updateBackend(after, backend);
72
75
  }
73
76
  onKeyDown(event) {
@@ -146,9 +149,9 @@ export class SmoothlyInput {
146
149
  this.value = this.lastValue = this.formatter.fromString(this.formatter.unformat(StateEditor.copy(Object.assign({}, this.state))).value);
147
150
  }
148
151
  render() {
149
- var _a;
150
- return (h(Host, { class: { "has-value": ((_a = this.state) === null || _a === void 0 ? void 0 : _a.value) != "" } },
151
- h("input", { name: this.name, type: this.state.type, placeholder: this.placeholder, required: this.required, autocomplete: this.autocomplete ? this.state.autocomplete : "off", disabled: this.disabled, pattern: this.state.pattern && this.state.pattern.source, value: this.state.value, onInput: (e) => this.onInput(e), onFocus: e => this.onFocus(e), onClick: e => this.onClick(e), onBlur: e => this.onBlur(e), onKeyDown: e => this.onKeyDown(e), ref: (el) => (this.inputElement = el), onPaste: e => this.onPaste(e) }),
152
+ var _a, _b, _c, _d, _e, _f, _g;
153
+ return (h(Host, { class: { "has-value": ((_a = this.state) === null || _a === void 0 ? void 0 : _a.value) != undefined && ((_b = this.state) === null || _b === void 0 ? void 0 : _b.value) != "" } },
154
+ h("input", { name: this.name, type: (_c = this.state) === null || _c === void 0 ? void 0 : _c.type, placeholder: this.placeholder, required: this.required, autocomplete: this.autocomplete ? (_d = this.state) === null || _d === void 0 ? void 0 : _d.autocomplete : "off", disabled: this.disabled, pattern: ((_e = this.state) === null || _e === void 0 ? void 0 : _e.pattern) && ((_f = this.state) === null || _f === void 0 ? void 0 : _f.pattern.source), value: (_g = this.state) === null || _g === void 0 ? void 0 : _g.value, onInput: (e) => this.onInput(e), onFocus: e => this.onFocus(e), onClick: e => this.onClick(e), onBlur: e => this.onBlur(e), onKeyDown: e => this.onKeyDown(e), ref: (el) => (this.inputElement = el), onPaste: e => this.onPaste(e) }),
152
155
  h("smoothly-icon", { name: "alert-circle", color: "danger", fill: "clear", size: "small" }),
153
156
  h("label", { htmlFor: this.name },
154
157
  h("slot", null))));
@@ -345,7 +348,7 @@ export class SmoothlyInput {
345
348
  "mutable": false,
346
349
  "complexType": {
347
350
  "original": "Currency",
348
- "resolved": "Currency | undefined",
351
+ "resolved": "\"AED\" | \"AFN\" | \"ALL\" | \"AMD\" | \"ANG\" | \"AOA\" | \"ARS\" | \"AUD\" | \"AWG\" | \"AZN\" | \"BAM\" | \"BBD\" | \"BDT\" | \"BGN\" | \"BHD\" | \"BIF\" | \"BMD\" | \"BND\" | \"BOB\" | \"BOV\" | \"BRL\" | \"BSD\" | \"BTN\" | \"BWP\" | \"BYN\" | \"BZD\" | \"CAD\" | \"CDF\" | \"CHE\" | \"CHF\" | \"CHW\" | \"CLF\" | \"CLP\" | \"CNY\" | \"COP\" | \"COU\" | \"CRC\" | \"CUC\" | \"CUP\" | \"CVE\" | \"CZK\" | \"DJF\" | \"DKK\" | \"DOP\" | \"DZD\" | \"EGP\" | \"ERN\" | \"ETB\" | \"EUR\" | \"FJD\" | \"FKP\" | \"GBP\" | \"GEL\" | \"GHS\" | \"GIP\" | \"GMD\" | \"GNF\" | \"GTQ\" | \"GYD\" | \"HKD\" | \"HNL\" | \"HRK\" | \"HTG\" | \"HUF\" | \"IDR\" | \"ILS\" | \"INR\" | \"IQD\" | \"IRR\" | \"ISK\" | \"JMD\" | \"JOD\" | \"JPY\" | \"KES\" | \"KGS\" | \"KHR\" | \"KMF\" | \"KPW\" | \"KRW\" | \"KWD\" | \"KYD\" | \"KZT\" | \"LAK\" | \"LBP\" | \"LKR\" | \"LRD\" | \"LSL\" | \"LYD\" | \"MAD\" | \"MDL\" | \"MGA\" | \"MKD\" | \"MMK\" | \"MNT\" | \"MOP\" | \"MRU\" | \"MUR\" | \"MVR\" | \"MWK\" | \"MXN\" | \"MXV\" | \"MYR\" | \"MZN\" | \"NAD\" | \"NGN\" | \"NIO\" | \"NOK\" | \"NPR\" | \"NZD\" | \"OMR\" | \"PAB\" | \"PEN\" | \"PGK\" | \"PHP\" | \"PKR\" | \"PLN\" | \"PYG\" | \"QAR\" | \"RON\" | \"RSD\" | \"RUB\" | \"RWF\" | \"SAR\" | \"SBD\" | \"SCR\" | \"SDG\" | \"SEK\" | \"SGD\" | \"SHP\" | \"SLL\" | \"SOS\" | \"SRD\" | \"SSP\" | \"STN\" | \"SVC\" | \"SYP\" | \"SZL\" | \"THB\" | \"TJS\" | \"TMT\" | \"TND\" | \"TOP\" | \"TRY\" | \"TTD\" | \"TWD\" | \"TZS\" | \"UAH\" | \"UGX\" | \"USD\" | \"USN\" | \"UYI\" | \"UYU\" | \"UYW\" | \"UZS\" | \"VES\" | \"VND\" | \"VUV\" | \"WST\" | \"XAF\" | \"XAG\" | \"XAU\" | \"XBA\" | \"XBB\" | \"XBC\" | \"XBD\" | \"XCD\" | \"XDR\" | \"XOF\" | \"XPD\" | \"XPF\" | \"XPT\" | \"XSU\" | \"XTS\" | \"XUA\" | \"XXX\" | \"YER\" | \"ZAR\" | \"ZMW\" | \"ZWL\" | undefined",
349
352
  "references": {
350
353
  "Currency": {
351
354
  "location": "import",
@@ -434,3 +437,7 @@ export class SmoothlyInput {
434
437
  "methodName": "valueWatcher"
435
438
  }]; }
436
439
  }
440
+ function getLocale() {
441
+ const result = navigator.language;
442
+ return Locale.is(result) ? result : Language.is(result) ? Locale.toLocale(result) : undefined;
443
+ }
@@ -1,6 +1,7 @@
1
1
  :host {
2
2
  display: block;
3
3
  position: relative;
4
+ font-weight: var(--smoothly-font-weight);
4
5
  }
5
6
  :host[hidden] {
6
7
  display: none;
@@ -1,9 +1,13 @@
1
- import { Component, Event, h, Prop, Watch } from "@stencil/core";
1
+ import { Component, Event, h, Listen, Prop, Watch } from "@stencil/core";
2
2
  import { Date } from "isoly";
3
3
  export class InputDate {
4
4
  onStart(next) {
5
5
  this.valueChanged.emit(next);
6
6
  }
7
+ dateSetHandler(e) {
8
+ this.open = false;
9
+ e.stopPropagation();
10
+ }
7
11
  render() {
8
12
  var _a;
9
13
  return [
@@ -136,4 +140,11 @@ export class InputDate {
136
140
  "propName": "value",
137
141
  "methodName": "onStart"
138
142
  }]; }
143
+ static get listeners() { return [{
144
+ "name": "dateSet",
145
+ "method": "dateSetHandler",
146
+ "target": undefined,
147
+ "capture": false,
148
+ "passive": false
149
+ }]; }
139
150
  }
@@ -1,19 +1,21 @@
1
1
  import { Component, Event, h, Listen, Prop, Watch } from "@stencil/core";
2
- import { Date } from "isoly";
2
+ import { Date, DateRange } from "isoly";
3
3
  export class InputDateRange {
4
4
  onValue(next) {
5
5
  this.valueChanged.emit(next);
6
6
  }
7
- onClose(open) {
8
- if (open == false && Date.is(this.start) && Date.is(this.end))
9
- this.dateRangeSelected.emit({ start: this.start, end: this.end });
10
- }
11
7
  onStartChanged(event) {
12
8
  this.start = event.detail;
13
9
  }
14
10
  onEndChanged(event) {
15
11
  this.end = event.detail;
16
12
  }
13
+ onDateRangeSet(event) {
14
+ console.log("dateRangeSet", event.detail);
15
+ this.open = false;
16
+ event.stopPropagation();
17
+ DateRange.is(event.detail) && this.dateRangeSelected.emit(event.detail);
18
+ }
17
19
  render() {
18
20
  var _a;
19
21
  return [
@@ -26,7 +28,7 @@ export class InputDateRange {
26
28
  h("smoothly-calendar", { doubleInput: true, value: (_a = this.value) !== null && _a !== void 0 ? _a : Date.now(), onValueChanged: event => {
27
29
  this.value = event.detail;
28
30
  event.stopPropagation();
29
- }, max: this.max, min: this.min }))) : ([]),
31
+ }, start: this.start, end: this.end, max: this.max, min: this.min }))) : ([]),
30
32
  ];
31
33
  }
32
34
  static get is() { return "smoothly-input-date-range"; }
@@ -210,15 +212,6 @@ export class InputDateRange {
210
212
  static get watchers() { return [{
211
213
  "propName": "value",
212
214
  "methodName": "onValue"
213
- }, {
214
- "propName": "open",
215
- "methodName": "onClose"
216
- }, {
217
- "propName": "start",
218
- "methodName": "onClose"
219
- }, {
220
- "propName": "end",
221
- "methodName": "onClose"
222
215
  }]; }
223
216
  static get listeners() { return [{
224
217
  "name": "startChanged",
@@ -232,5 +225,11 @@ export class InputDateRange {
232
225
  "target": undefined,
233
226
  "capture": false,
234
227
  "passive": false
228
+ }, {
229
+ "name": "dateRangeSet",
230
+ "method": "onDateRangeSet",
231
+ "target": undefined,
232
+ "capture": false,
233
+ "passive": false
235
234
  }]; }
236
235
  }
@@ -26,8 +26,9 @@ export class SmoothlySelectDemo {
26
26
  h("option", { value: "1" }, "1"),
27
27
  h("option", { value: "2" }, "2"),
28
28
  h("option", { value: "3" }, "3")),
29
- h("smoothly-input-date", { max: "2021-12-30", min: "2021-10-10" }, "Date"),
30
- h("smoothly-input-date-range", { max: "2021-12-30", min: "2021-10-10" }),
29
+ h("smoothly-input-date", null, "Date"),
30
+ h("smoothly-input-date", { value: "2021-10-28", max: "2021-12-30", min: "2021-10-10" }, "Date"),
31
+ h("smoothly-input-date-range", { start: "2021-10-28", end: "2021-11-27", min: "2021-10-10", max: "2021-12-30" }),
31
32
  h("smoothly-selector", null,
32
33
  h("smoothly-item", { value: "1" }, "January"),
33
34
  h("smoothly-item", { value: "2" }, "February"),
@@ -1,3 +1,3 @@
1
1
  export { App } from "./components/App";
2
- export { ClientIdentifier, Message, Notice, Trigger } from "./model";
2
+ export { ClientIdentifier, GoogleFont, Message, Notice, Trigger, } from "./model";
3
3
  export { Cosmetic } from "./utilities";
@@ -0,0 +1,19 @@
1
+ export var GoogleFont;
2
+ (function (GoogleFont) {
3
+ function is(value) {
4
+ return (typeof value == "string" &&
5
+ !/[</>"'`]/g.test(value) &&
6
+ /^([a-zA-ZäöüåßÄÖÜÅ+ ])+(:(ital(,)?)?((wght@(([01],\d{3})(;[01],\d{3})+|((\d{3})(;\d{3})+))))?)?$/g.test(value));
7
+ }
8
+ GoogleFont.is = is;
9
+ function getFont(value) {
10
+ return is(value) ? value.split(":")[0].replace(/\+/g, " ") : undefined;
11
+ }
12
+ GoogleFont.getFont = getFont;
13
+ function styleImportString(value) {
14
+ return is(value)
15
+ ? `@import url('https://fonts.googleapis.com/css2?family=${value.replace(/ /g, "+")}&display=swap`
16
+ : undefined;
17
+ }
18
+ GoogleFont.styleImportString = styleImportString;
19
+ })(GoogleFont || (GoogleFont = {}));
@@ -1,4 +1,5 @@
1
1
  export { ClientIdentifier } from "./ClientIdentifier";
2
+ export { GoogleFont } from "./GoogleFont";
2
3
  export { Message } from "./Message";
3
4
  export { Notice } from "./Notice";
4
5
  export { Trigger } from "./Trigger";
@@ -80,6 +80,12 @@ export const SmoothlyFrame: {
80
80
  new (): SmoothlyFrame;
81
81
  };
82
82
 
83
+ interface SmoothlyGoogleFont extends Components.SmoothlyGoogleFont, HTMLElement {}
84
+ export const SmoothlyGoogleFont: {
85
+ prototype: SmoothlyGoogleFont;
86
+ new (): SmoothlyGoogleFont;
87
+ };
88
+
83
89
  interface SmoothlyIcon extends Components.SmoothlyIcon, HTMLElement {}
84
90
  export const SmoothlyIcon: {
85
91
  prototype: SmoothlyIcon;