@omegagrid/core 0.10.58 → 0.10.60

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.
@@ -1,7 +1,9 @@
1
1
  import { ComponentFactory, ComponentId } from "../types";
2
2
  export declare class ComponentStore<T extends HTMLElement = HTMLElement> {
3
- readonly factory: ComponentFactory<T>;
4
3
  readonly items: Map<ComponentId, T>;
4
+ private _resolutions;
5
+ private _factory;
6
+ get factory(): ComponentFactory<T>;
5
7
  constructor(factory: ComponentFactory<T>);
6
8
  get(id: ComponentId): Promise<T>;
7
9
  remove(id: ComponentId): this;
@@ -1 +1 @@
1
- {"version":3,"file":"componentStore.d.ts","sourceRoot":"","sources":["../../src/model/componentStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEzD,qBAAa,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW;aAIlC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAFxD,SAAgB,KAAK,sBAA6B;gBAEtB,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAElD,GAAG,CAAC,EAAE,EAAE,WAAW;IAKzB,MAAM,CAAC,EAAE,EAAE,WAAW;IAKtB,GAAG,CAAC,EAAE,EAAE,WAAW;IAInB,KAAK;IAIL,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,WAAW,KAAK,IAAI;CAKpD"}
1
+ {"version":3,"file":"componentStore.d.ts","sourceRoot":"","sources":["../../src/model/componentStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEzD,qBAAa,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW;IAE9D,SAAgB,KAAK,sBAA6B;IAElD,OAAO,CAAC,YAAY,CAAkF;IACtG,OAAO,CAAC,QAAQ,CAAsB;IACtC,IAAI,OAAO,wBAA2B;gBAE1B,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC;IA6BlC,GAAG,CAAC,EAAE,EAAE,WAAW;IAKzB,MAAM,CAAC,EAAE,EAAE,WAAW;IAKtB,GAAG,CAAC,EAAE,EAAE,WAAW;IAInB,KAAK;IAIL,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,WAAW,KAAK,IAAI;CAKpD"}
@@ -1,11 +1,38 @@
1
1
  export class ComponentStore {
2
+ get factory() { return this._factory; }
2
3
  constructor(factory) {
3
- this.factory = factory;
4
4
  this.items = new Map();
5
+ this._resolutions = new Map();
6
+ this._factory = (id) => new Promise((resolve, reject) => {
7
+ if (this._resolutions.has(id)) {
8
+ this._resolutions.get(id).push([resolve, reject]);
9
+ return;
10
+ }
11
+ this._resolutions.set(id, [[resolve, reject]]);
12
+ const res = factory(id);
13
+ if (res instanceof Promise) {
14
+ res.then((component) => {
15
+ this.items.set(id, component);
16
+ const resolutions = this._resolutions.get(id) || [];
17
+ resolutions.forEach(([resolve]) => resolve(component));
18
+ this._resolutions.delete(id);
19
+ }).catch((error) => {
20
+ const resolutions = this._resolutions.get(id) || [];
21
+ resolutions.forEach(([, reject]) => reject(error));
22
+ this._resolutions.delete(id);
23
+ });
24
+ }
25
+ else {
26
+ this.items.set(id, res);
27
+ const resolutions = this._resolutions.get(id) || [];
28
+ resolutions.forEach(([resolve]) => resolve(res));
29
+ this._resolutions.delete(id);
30
+ }
31
+ });
5
32
  }
6
33
  async get(id) {
7
34
  if (!this.items.has(id))
8
- this.items.set(id, await this.factory(id));
35
+ this.items.set(id, await this._factory(id));
9
36
  return this.items.get(id);
10
37
  }
11
38
  remove(id) {
@@ -1 +1 @@
1
- {"version":3,"file":"componentStore.js","sourceRoot":"","sources":["../../src/model/componentStore.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,cAAc;IAI1B,YAA4B,OAA4B;QAA5B,YAAO,GAAP,OAAO,CAAqB;QAFxC,UAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEU,CAAC;IAE7D,KAAK,CAAC,GAAG,CAAC,EAAe;QACxB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,EAAe;QACrB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,GAAG,CAAC,EAAe;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;IAED,OAAO,CAAC,QAA4C;QACnD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACb,CAAC;CAED","sourcesContent":["import { ComponentFactory, ComponentId } from \"../types\";\n\nexport class ComponentStore<T extends HTMLElement = HTMLElement> {\n\n\tpublic readonly items = new Map<ComponentId, T>();\n\n\tconstructor(public readonly factory: ComponentFactory<T>) { }\n\n\tasync get(id: ComponentId) {\n\t\tif (!this.items.has(id)) this.items.set(id, await this.factory(id));\n\t\treturn this.items.get(id);\n\t}\n\n\tremove(id: ComponentId) {\n\t\tthis.items.delete(id);\n\t\treturn this;\n\t}\n\n\thas(id: ComponentId) {\n\t\treturn this.items.has(id);\n\t}\n\n\tclear() {\n\t\tthis.items.clear();\n\t}\n\n\tforEach(callback: (item: T, id: ComponentId) => void) {\n\t\tthis.items.forEach(callback);\n\t\treturn this;\n\t}\n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AAC,CAAC;IAC3B,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;IAED,OAAO,CAAC,QAA4C;QACnD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACb,CAAC;CAED","sourcesContent":["import { ComponentFactory, ComponentId } from \"../types\";\n\nexport class ComponentStore<T extends HTMLElement = HTMLElement> {\n\n\tpublic readonly items = new Map<ComponentId, T>();\n\t\n\tprivate _resolutions: Map<ComponentId, [(value: T) => void, (reason: unknown) => void][]> = new Map();\n\tprivate _factory: ComponentFactory<T>;\n\tget factory() { return this._factory }\n\n\tconstructor(factory: ComponentFactory<T>) { \n\t\tthis._factory = (id: ComponentId) => new Promise((resolve, reject) => {\n\t\t\tif (this._resolutions.has(id)) {\n\t\t\t\tthis._resolutions.get(id).push([resolve, reject]);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._resolutions.set(id, [[resolve, reject]]);\n\t\t\tconst res = factory(id);\n\t\t\tif (res instanceof Promise) {\n\t\t\t\tres.then((component) => {\n\t\t\t\t\tthis.items.set(id, component);\n\t\t\t\t\tconst resolutions = this._resolutions.get(id) || [];\n\t\t\t\t\tresolutions.forEach(([resolve]) => resolve(component));\n\t\t\t\t\tthis._resolutions.delete(id);\n\t\t\t\t}).catch((error) => {\n\t\t\t\t\tconst resolutions = this._resolutions.get(id) || [];\n\t\t\t\t\tresolutions.forEach(([, reject]) => reject(error));\n\t\t\t\t\tthis._resolutions.delete(id);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.items.set(id, res);\n\t\t\t\tconst resolutions = this._resolutions.get(id) || [];\n\t\t\t\tresolutions.forEach(([resolve]) => resolve(res));\n\t\t\t\tthis._resolutions.delete(id);\n\t\t\t}\n\t\t});\n\t}\n\n\tasync get(id: ComponentId) {\n\t\tif (!this.items.has(id)) this.items.set(id, await this._factory(id));\n\t\treturn this.items.get(id);\n\t}\n\n\tremove(id: ComponentId) {\n\t\tthis.items.delete(id);\n\t\treturn this;\n\t}\n\n\thas(id: ComponentId) {\n\t\treturn this.items.has(id);\n\t}\n\n\tclear() {\n\t\tthis.items.clear();\n\t}\n\n\tforEach(callback: (item: T, id: ComponentId) => void) {\n\t\tthis.items.forEach(callback);\n\t\treturn this;\n\t}\n\t\n}"]}
@@ -2,6 +2,7 @@ import { LitElement } from 'lit';
2
2
  export declare class Input extends LitElement {
3
3
  static styles: import("lit").CSSResult[];
4
4
  value: string;
5
+ placeholder: string;
5
6
  input: HTMLInputElement;
6
7
  constructor();
7
8
  _onInput: (e: InputEvent) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/ui/input.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAIvC,qBACa,KAAM,SAAQ,UAAU;IAEpC,MAAM,CAAC,MAAM,4BAAW;IAGxB,KAAK,EAAE,MAAM,CAAC;IAGd,KAAK,EAAE,gBAAgB,CAAC;;IAQxB,QAAQ,GAAI,GAAG,UAAU,UAExB;IAED,KAAK;IAIL,SAAS;IAIT,MAAM,6CAMJ;CAEF"}
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/ui/input.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAIvC,qBACa,KAAM,SAAQ,UAAU;IAEpC,MAAM,CAAC,MAAM,4BAAW;IAGxB,KAAK,EAAE,MAAM,CAAC;IAGd,WAAW,EAAE,MAAM,CAAC;IAGpB,KAAK,EAAE,gBAAgB,CAAC;;IAQxB,QAAQ,GAAI,GAAG,UAAU,UAExB;IAED,KAAK;IAIL,SAAS;IAIT,MAAM,6CAOJ;CAEF"}
package/dist/ui/input.js CHANGED
@@ -17,6 +17,7 @@ let Input = class Input extends LitElement {
17
17
  this.render = () => html `
18
18
  <input
19
19
  type="text"
20
+ placeholder="${this.placeholder || ''}"
20
21
  .value="${this.value || ''}"
21
22
  @input="${this._onInput}"
22
23
  @change="${() => this.dispatchEvent(new ChangeEvent({ value: this.input.value }))}">
@@ -35,6 +36,9 @@ Input.styles = [style];
35
36
  __decorate([
36
37
  property({ type: String })
37
38
  ], Input.prototype, "value", void 0);
39
+ __decorate([
40
+ property({ type: String })
41
+ ], Input.prototype, "placeholder", void 0);
38
42
  __decorate([
39
43
  query('input')
40
44
  ], Input.prototype, "input", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/ui/input.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAG/B,IAAM,KAAK,GAAX,MAAM,KAAM,SAAQ,UAAU;IAUpC;QACC,KAAK,EAAE,CAAC;QAKT,aAAQ,GAAG,CAAC,CAAa,EAAE,EAAE;YAC5B,IAAI,CAAC,KAAK,GAAI,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC;QACnD,CAAC,CAAA;QAUD,WAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA;;;aAGP,IAAI,CAAC,KAAK,IAAI,EAAE;aAChB,IAAI,CAAC,QAAQ;cACZ,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,EAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAC,CAAC,CAAC;EAChF,CAAC;QAtBD,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IAC1D,CAAC;IAMD,KAAK;QACJ,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC;IACrB,CAAC;IAED,SAAS;QACR,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IACtB,CAAC;;AAxBM,YAAM,GAAG,CAAC,KAAK,CAAC,AAAV,CAAW;AAGxB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;oCACX;AAGd;IADC,KAAK,CAAC,OAAO,CAAC;oCACS;AARZ,KAAK;IADjB,aAAa,CAAC,UAAU,CAAC;GACb,KAAK,CAoCjB","sourcesContent":["import { ChangeEvent } from '../common/events';\nimport { LitElement, html } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { style } from './input.style';\n\n@customElement(`og-input`)\nexport class Input extends LitElement {\n\n\tstatic styles = [style];\n\n\t@property({type: String})\n\tvalue: string;\n\n\t@query('input')\n\tinput: HTMLInputElement;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.tabIndex = 1;\n\t\tthis.addEventListener('focus', () => this.input.focus());\n\t}\n\n\t_onInput = (e: InputEvent) => {\n\t\tthis.value = (e.target as HTMLInputElement).value;\n\t}\n\n\tfocus() {\n\t\tthis.input?.focus();\n\t}\n\n\tselectAll() {\n\t\tthis.input?.select();\n\t}\n\n\trender = () => html`\n\t\t<input\n\t\t\ttype=\"text\"\n\t\t\t.value=\"${this.value || ''}\"\n\t\t\t@input=\"${this._onInput}\"\n\t\t\t@change=\"${() => this.dispatchEvent(new ChangeEvent({value: this.input.value}))}\">\n\t`;\n\t\n}"]}
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/ui/input.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,Q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LitElement, html } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { style } from './input.style';\n\n@customElement(`og-input`)\nexport class Input extends LitElement {\n\n\tstatic styles = [style];\n\n\t@property({type: String})\n\tvalue: string;\n\n\t@property({type: String})\n\tplaceholder: string;\n\n\t@query('input')\n\tinput: HTMLInputElement;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.tabIndex = 1;\n\t\tthis.addEventListener('focus', () => this.input.focus());\n\t}\n\n\t_onInput = (e: InputEvent) => {\n\t\tthis.value = (e.target as HTMLInputElement).value;\n\t}\n\n\tfocus() {\n\t\tthis.input?.focus();\n\t}\n\n\tselectAll() {\n\t\tthis.input?.select();\n\t}\n\n\trender = () => html`\n\t\t<input\n\t\t\ttype=\"text\"\n\t\t\tplaceholder=\"${this.placeholder || ''}\"\n\t\t\t.value=\"${this.value || ''}\"\n\t\t\t@input=\"${this._onInput}\"\n\t\t\t@change=\"${() => this.dispatchEvent(new ChangeEvent({value: this.input.value}))}\">\n\t`;\n\t\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"input.style.d.ts","sourceRoot":"","sources":["../../src/ui/input.style.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,yBAiCjB,CAAC"}
1
+ {"version":3,"file":"input.style.d.ts","sourceRoot":"","sources":["../../src/ui/input.style.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,yBAsCjB,CAAC"}
@@ -28,6 +28,11 @@ export const style = css `
28
28
  padding: 0 4px;
29
29
  }
30
30
 
31
+ input::placeholder {
32
+ color: var(--og-text-color-2);
33
+ opacity: 0.7;
34
+ }
35
+
31
36
  input[disabled] {
32
37
  opacity: 0.5;
33
38
  cursor: not-allowed;
@@ -1 +1 @@
1
- {"version":3,"file":"input.style.js","sourceRoot":"","sources":["../../src/ui/input.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCvB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const style = css`\n\t:host {\n\t\tbox-sizing: border-box;\n\t\tbackground-color: var(--og-colortype-gray-background-color);\n\t\tborder: 1px solid var(--og-colortype-gray-border-color);\n\t\theight: 20px;\n\t\tline-height: 20px;\n\t\tdisplay: inline-block;\n\t\tborder-radius: var(--og-base-radius);\n\t}\n\t\n\t* {\n\t\tbox-sizing: border-box;\n\t}\n\t\n\tinput {\n\t\tdisplay: block;\n\t\tcolor: var(--og-text-color-3);\n\t\tfont-size: var(--og-font-size);\n\t\tfont-family: var(--og-font-family);\n\t\tborder: none;\n\t\tbackground-color: inherit;\n\t\toutline: none;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\ttext-align: inherit;\n\t\tpadding: 0 4px;\n\t}\n\n\tinput[disabled] {\n\t\topacity: 0.5;\n\t\tcursor: not-allowed;\n\t}\n`;\n"]}
1
+ {"version":3,"file":"input.style.js","sourceRoot":"","sources":["../../src/ui/input.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCvB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const style = css`\n\t:host {\n\t\tbox-sizing: border-box;\n\t\tbackground-color: var(--og-colortype-gray-background-color);\n\t\tborder: 1px solid var(--og-colortype-gray-border-color);\n\t\theight: 20px;\n\t\tline-height: 20px;\n\t\tdisplay: inline-block;\n\t\tborder-radius: var(--og-base-radius);\n\t}\n\t\n\t* {\n\t\tbox-sizing: border-box;\n\t}\n\t\n\tinput {\n\t\tdisplay: block;\n\t\tcolor: var(--og-text-color-3);\n\t\tfont-size: var(--og-font-size);\n\t\tfont-family: var(--og-font-family);\n\t\tborder: none;\n\t\tbackground-color: inherit;\n\t\toutline: none;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\ttext-align: inherit;\n\t\tpadding: 0 4px;\n\t}\n\n\tinput::placeholder {\n\t\tcolor: var(--og-text-color-2);\n\t\topacity: 0.7;\n\t}\n\n\tinput[disabled] {\n\t\topacity: 0.5;\n\t\tcursor: not-allowed;\n\t}\n`;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omegagrid/core",
3
- "version": "0.10.58",
3
+ "version": "0.10.60",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Core components",
6
6
  "main": "./dist/index.js",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@fortawesome/fontawesome-svg-core": "^7.0.1",
39
- "@omegagrid/localize": "^0.10.58",
39
+ "@omegagrid/localize": "^0.10.60",
40
40
  "color": "^4.2.3",
41
41
  "date-fns": "^3.2.0",
42
42
  "lit": "^3.1.1",