@things-factory/ai-dashboard 10.1.256 → 10.1.258
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/client/components/card-dialogs.ts +31 -24
- package/client/components/card-library.ts +20 -16
- package/client/components/dashboard-card.ts +33 -28
- package/client/components/proposal-preview.ts +15 -16
- package/client/pages/my-dashboard-page.ts +33 -32
- package/client/utils/card-api.ts +28 -39
- package/dist-client/components/card-dialogs.d.ts +9 -5
- package/dist-client/components/card-dialogs.js +25 -35
- package/dist-client/components/card-dialogs.js.map +1 -1
- package/dist-client/components/card-library.d.ts +3 -3
- package/dist-client/components/card-library.js +13 -22
- package/dist-client/components/card-library.js.map +1 -1
- package/dist-client/components/dashboard-card.d.ts +5 -6
- package/dist-client/components/dashboard-card.js +26 -46
- package/dist-client/components/dashboard-card.js.map +1 -1
- package/dist-client/components/proposal-preview.d.ts +3 -5
- package/dist-client/components/proposal-preview.js +13 -25
- package/dist-client/components/proposal-preview.js.map +1 -1
- package/dist-client/pages/my-dashboard-page.d.ts +8 -5
- package/dist-client/pages/my-dashboard-page.js +31 -44
- package/dist-client/pages/my-dashboard-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/utils/card-api.d.ts +20 -35
- package/dist-client/utils/card-api.js +12 -23
- package/dist-client/utils/card-api.js.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card-dialogs.js","sourceRoot":"","sources":["../../client/components/card-dialogs.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,OAAO,4BAA4B,CAAA;AACnC,OAAO,uCAAuC,CAAA;AAC9C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,oCAAoC,CAAA;AAE3C,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EA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I,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IAC3H,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAc,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAA,oCAAoC,IAAI,+BAA+B,EAAE,CAAC,CAAC,sBAAsB,CAAC,EAAE,QAAQ,CAAC,CAAA;AAC1K,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAc,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAA,wCAAwC,IAAI,mCAAmC,EAAE,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAA;AAC1K,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAc,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAA,uCAAuC,IAAI,kCAAkC,EAAE,CAAC,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAA;AACtM,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAc,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAA,qCAAqC,IAAI,gCAAgC,EAAE,CAAC,CAAC,4BAA4B,CAAC,EAAE,QAAQ,CAAC,CAAA","sourcesContent":["/*\n * The small forms a card opens - what to change with the assistant, a new name, whom to share it with, and its\n * versions (ADR-0160 decisions 7, 9). Each changes one card through its own door and tells an open dashboard.\n */\nimport '@material/web/icon/icon.js'\nimport '@material/web/button/filled-button.js'\nimport '@material/web/button/text-button.js'\nimport '@operato/popup/ox-popup-actions.js'\n\nimport { LitElement, css, html, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { CommonPopupStyles, PopupBodyStyles } from '@operato/styles'\nimport { askAssistant } from '@things-factory/ai-assistant/dist-client/index.js'\n\nimport { cardApi, dashboardChanged, type CardItem, type CardShare } from '../utils/card-api.js'\nimport { cardSelection } from '../utils/card-words.js'\n\nconst t = (key: string, options: Record<string, unknown> = {}) => String(i18next.t(key, options))\n\n/*\n * The house popup (CommonPopupStyles, PopupBodyStyles): only .body scrolls and ox-popup-actions stays put - a share\n * list of three people pushed 저장 out of sight (2026-10-25). The form fills the popup it is opened in.\n */\nconst FormStyles = css`\n :host {\n height: 100%;\n line-height: 1.5;\n }\n\n p.lead,\n p.note {\n margin: 0;\n }\n\n p.lead {\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n }\n\n textarea,\n input[type='text'],\n input[type='search'] {\n box-sizing: border-box;\n width: 100%;\n padding: 9px 12px;\n border: 1px solid var(--ui-line, var(--md-sys-color-outline-variant));\n border-radius: 8px;\n background: var(--ui-panel, var(--md-sys-color-surface-container-lowest));\n color: inherit;\n font: inherit;\n }\n\n textarea {\n min-height: 88px;\n resize: vertical;\n }\n\n textarea:focus,\n input:focus {\n outline: 2px solid color-mix(in srgb, var(--ui-accent, var(--md-sys-color-primary)) 40%, transparent);\n border-color: var(--ui-accent, var(--md-sys-color-primary));\n }\n\n .hints {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n }\n\n .hints button {\n padding: 4px 10px;\n border: 1px solid var(--ui-line, var(--md-sys-color-outline-variant));\n border-radius: 999px;\n background: transparent;\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n font: inherit;\n font-size: var(--ui-t-small, 12px);\n cursor: pointer;\n }\n\n .hints button:hover {\n border-color: var(--ui-accent, var(--md-sys-color-primary));\n color: var(--ui-accent, var(--md-sys-color-primary));\n }\n\n h5 {\n margin: 6px 0 0;\n font-size: var(--ui-t-small, 12px);\n font-weight: 600;\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n text-transform: none;\n }\n\n label.option {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 8px 10px;\n border: 1px solid var(--ui-line-soft, var(--md-sys-color-outline-variant));\n border-radius: 8px;\n cursor: pointer;\n }\n\n label.option small {\n margin-left: auto;\n color: var(--ui-faint, var(--md-sys-color-on-surface-variant));\n }\n\n .people {\n display: flex;\n flex-direction: column;\n gap: 6px;\n }\n\n .person {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 6px 10px;\n border-radius: 8px;\n background: var(--ui-panel-2, var(--md-sys-color-surface-container-low));\n --md-icon-size: 16px;\n }\n\n .person small {\n color: var(--ui-faint, var(--md-sys-color-on-surface-variant));\n }\n\n .person button,\n .found button {\n margin-left: auto;\n border: 0;\n background: transparent;\n color: var(--ui-accent, var(--md-sys-color-primary));\n font: inherit;\n cursor: pointer;\n }\n\n .found {\n display: flex;\n flex-direction: column;\n border: 1px solid var(--ui-line-soft, var(--md-sys-color-outline-variant));\n border-radius: 8px;\n }\n\n .found div {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 6px 10px;\n }\n\n .found div + div {\n border-top: 1px solid var(--ui-line-soft, var(--md-sys-color-outline-variant));\n }\n\n ol.versions {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n gap: 6px;\n }\n\n ol.versions li {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 10px 12px;\n border: 1px solid var(--ui-line-soft, var(--md-sys-color-outline-variant));\n border-radius: 8px;\n }\n\n ol.versions .v {\n flex: none;\n min-width: 36px;\n font-weight: 650;\n font-variant-numeric: tabular-nums;\n color: var(--ui-accent, var(--md-sys-color-primary));\n }\n\n ol.versions .label {\n flex: 1;\n min-width: 0;\n }\n\n ol.versions small {\n display: block;\n color: var(--ui-faint, var(--md-sys-color-on-surface-variant));\n }\n`\n\n/** What to change in a card - sent to the conversation beside the page with the card picked, as a screen request. */\n@customElement('ai-dashboard-card-ai-form')\nexport class CardAiForm extends localize(i18next)(LitElement) {\n static styles = [CommonPopupStyles, PopupBodyStyles, FormStyles]\n @property({ attribute: false }) card!: CardItem\n @state() private text = ''\n\n render() {\n const hints = ['ai-dashboard.ai.hint-period', 'ai-dashboard.ai.hint-top', 'ai-dashboard.ai.hint-line', 'ai-dashboard.ai.hint-table']\n return html`<div class=\"body\">\n <p class=\"lead\">${t('ai-dashboard.ai.lead', { name: this.card.name })}</p>\n <textarea .value=${this.text} placeholder=${t('ai-dashboard.ai.placeholder')} @input=${(e: any) => (this.text = e.target.value)} @keydown=${(e: KeyboardEvent) => e.key === 'Enter' && (e.metaKey || e.ctrlKey) && this.send()}></textarea>\n <div class=\"hints\">${hints.map(key => html`<button @click=${() => (this.text = t(key))}>${t(key)}</button>`)}</div>\n </div>\n <ox-popup-actions>\n <md-text-button slot=\"cancel\" @click=${() => this.close()}>${t('ai-dashboard.button.cancel')}</md-text-button>\n <md-filled-button slot=\"confirm\" ?disabled=${!this.text.trim()} @click=${() => this.send()}>${t('ai-dashboard.ai.send')}</md-filled-button>\n </ox-popup-actions>`\n }\n\n private close() {\n this.dispatchEvent(new CustomEvent('done', { bubbles: true, composed: true }))\n }\n\n private send() {\n if (!this.text.trim()) return\n /* Closed first: the dock opens over the page, and a popup that is no longer the top one refuses to close. */\n this.close()\n askAssistant({\n ask: t('ai-dashboard.ai.ask', { name: this.card.name, version: this.card.version, change: this.text.trim() }),\n selection: cardSelection(this.card, t('ai-dashboard.title'))\n })\n }\n}\n\n/** A card's new name - a new version. */\n@customElement('ai-dashboard-card-rename-form')\nexport class CardRenameForm extends localize(i18next)(LitElement) {\n static styles = [CommonPopupStyles, PopupBodyStyles, FormStyles]\n @property({ attribute: false }) card!: CardItem\n @state() private name = ''\n\n connectedCallback() {\n super.connectedCallback()\n this.name = this.card?.name ?? ''\n }\n\n render() {\n return html`<div class=\"body\">\n <input type=\"text\" .value=${this.name} maxlength=\"100\" @input=${(e: any) => (this.name = e.target.value)} @keydown=${(e: KeyboardEvent) => e.key === 'Enter' && this.save()} />\n </div>\n <ox-popup-actions>\n <md-text-button slot=\"cancel\" @click=${() => this.close()}>${t('ai-dashboard.button.cancel')}</md-text-button>\n <md-filled-button slot=\"confirm\" ?disabled=${!this.name.trim() || this.name.trim() === this.card.name} @click=${() => this.save()}>${t('ai-dashboard.button.save')}</md-filled-button>\n </ox-popup-actions>`\n }\n\n private close() {\n this.dispatchEvent(new CustomEvent('done', { bubbles: true, composed: true }))\n }\n\n private async save() {\n try {\n await cardApi.rename(this.card.id, this.name.trim())\n dashboardChanged()\n this.close()\n } catch (error: any) {\n notify({ level: 'error', message: error?.message ?? String(error) })\n }\n }\n}\n\n/** Whom one's own card is shared with - the whole domain, one's own departments, people found by name. */\n@customElement('ai-dashboard-card-share-form')\nexport class CardShareForm extends localize(i18next)(LitElement) {\n static styles = [CommonPopupStyles, PopupBodyStyles, FormStyles]\n @property({ attribute: false }) card!: CardItem\n @state() private options?: Awaited<ReturnType<typeof cardApi.shareOptions>>\n @state() private shares: CardShare[] = []\n @state() private found: { id: string; name: string; note?: string }[] = []\n @state() private search = ''\n private searching?: ReturnType<typeof setTimeout>\n\n async connectedCallback() {\n super.connectedCallback()\n this.shares = [...(this.card?.shares ?? [])].map(({ scope, targetId, targetName }) => ({ scope, targetId, targetName }))\n try {\n this.options = await cardApi.shareOptions()\n } catch (error: any) {\n notify({ level: 'error', message: error?.message ?? String(error) })\n }\n }\n\n private has(scope: string, id: string) {\n return this.shares.some(one => one.scope === scope && one.targetId === id)\n }\n\n private toggle(share: CardShare, on: boolean) {\n this.shares = on ? [...this.shares.filter(one => !(one.scope === share.scope && one.targetId === share.targetId)), share] : this.shares.filter(one => !(one.scope === share.scope && one.targetId === share.targetId))\n }\n\n private find(text: string) {\n this.search = text\n clearTimeout(this.searching)\n this.searching = setTimeout(async () => {\n try {\n this.found = text.trim() ? await cardApi.people(text.trim()) : []\n } catch {\n this.found = []\n }\n }, 250)\n }\n\n render() {\n const options = this.options\n const people = this.shares.filter(one => one.scope === 'USER')\n return html`<div class=\"body\">\n <p class=\"lead\">${t('ai-dashboard.share.lead')}</p>\n ${options\n ? html`<h5>${t('ai-dashboard.share.everyone-title')}</h5>\n <label class=\"option\">\n <input type=\"checkbox\" .checked=${this.has('DOMAIN', options.domainId)} @change=${(e: any) => this.toggle({ scope: 'DOMAIN', targetId: options.domainId, targetName: options.domainName }, e.target.checked)} />\n <md-icon>domain</md-icon>${t('ai-dashboard.share.everyone-in', { name: options.domainName })}\n </label>\n ${options.departments.length\n ? html`<h5>${t('ai-dashboard.share.departments')}</h5>\n ${options.departments.map(\n one => html`<label class=\"option\">\n <input type=\"checkbox\" .checked=${this.has('DEPARTMENT', one.id)} @change=${(e: any) => this.toggle({ scope: 'DEPARTMENT', targetId: one.id, targetName: one.name }, e.target.checked)} />\n <md-icon>groups</md-icon>${one.name}<small>${t('ai-dashboard.share.department-members')}</small>\n </label>`\n )}`\n : nothing}\n ${options.roles.length\n ? html`<h5>${t('ai-dashboard.share.roles')}</h5>\n ${options.roles.map(\n one => html`<label class=\"option\">\n <input type=\"checkbox\" .checked=${this.has('ROLE', one.id)} @change=${(e: any) => this.toggle({ scope: 'ROLE', targetId: one.id, targetName: one.name }, e.target.checked)} />\n <md-icon>badge</md-icon>${one.name}<small>${t('ai-dashboard.share.role-holders')}</small>\n </label>`\n )}`\n : nothing}\n <h5>${t('ai-dashboard.share.people')}</h5>\n ${people.length\n ? html`<div class=\"people\">\n ${people.map(one => html`<div class=\"person\"><md-icon>person</md-icon>${one.targetName ?? one.targetId}<button @click=${() => this.toggle(one, false)}>${t('ai-dashboard.share.remove')}</button></div>`)}\n </div>`\n : nothing}\n ${options.peopleAvailable\n ? html`<input type=\"search\" .value=${this.search} placeholder=${t('ai-dashboard.share.find-person')} @input=${(e: any) => this.find(e.target.value)} />\n ${this.found.length\n ? html`<div class=\"found\">\n ${this.found\n .filter(one => !this.has('USER', one.id))\n .map(one => html`<div><md-icon>person_add</md-icon>${one.name} ${one.note ? html`<small>${one.note}</small>` : nothing}<button @click=${() => this.toggle({ scope: 'USER', targetId: one.id, targetName: one.name }, true)}>${t('ai-dashboard.share.add')}</button></div>`)}\n </div>`\n : nothing}`\n : html`<p class=\"note\">${t('ai-dashboard.share.people-unavailable')}</p>`}\n <p class=\"note\">${t('ai-dashboard.share.rule')}</p>`\n : nothing}\n </div>\n <ox-popup-actions>\n <md-text-button slot=\"cancel\" @click=${() => this.close()}>${t('ai-dashboard.button.cancel')}</md-text-button>\n <md-filled-button slot=\"confirm\" ?disabled=${!options} @click=${() => this.save()}>${t('ai-dashboard.button.save')}</md-filled-button>\n </ox-popup-actions>`\n }\n\n private close() {\n this.dispatchEvent(new CustomEvent('done', { bubbles: true, composed: true }))\n }\n\n private async save() {\n try {\n await cardApi.share(this.card.id, this.shares)\n notify({ level: 'info', message: t(this.shares.length ? 'ai-dashboard.text.shared' : 'ai-dashboard.text.private', { name: this.card.name }) })\n dashboardChanged()\n this.close()\n } catch (error: any) {\n notify({ level: 'error', message: error?.message ?? String(error) })\n }\n }\n}\n\n/** One's own card's versions, newest first - an earlier one comes back as a new version. */\n@customElement('ai-dashboard-card-versions')\nexport class CardVersions extends localize(i18next)(LitElement) {\n static styles = [CommonPopupStyles, PopupBodyStyles, FormStyles]\n @property({ attribute: false }) card!: CardItem\n @state() private versions?: Awaited<ReturnType<typeof cardApi.versions>>\n\n async connectedCallback() {\n super.connectedCallback()\n try {\n this.versions = await cardApi.versions(this.card.id)\n } catch (error: any) {\n notify({ level: 'error', message: error?.message ?? String(error) })\n }\n }\n\n render() {\n const view = (definition: any) => t(`ai-dashboard.view.${definition?.view?.kind ?? 'table'}`)\n return html`<div class=\"body\">\n <p class=\"lead\">${t('ai-dashboard.versions.lead')}</p>\n <ol class=\"versions\">\n ${(this.versions ?? []).map(\n one => html`<li>\n <span class=\"v\">v${one.version}</span>\n <span class=\"label\">${one.name}<small>${view(one.definition)} · ${one.creatorName ?? ''} · ${one.createdAt ? new Date(one.createdAt).toLocaleString(i18next.language) : ''}</small></span>\n ${one.version === this.card.version\n ? html`<small>${t('ai-dashboard.versions.current')}</small>`\n : html`<md-text-button @click=${() => this.restore(one.version)}>${t('ai-dashboard.versions.restore')}</md-text-button>`}\n </li>`\n )}\n </ol>\n </div>`\n }\n\n private async restore(version: number) {\n try {\n await cardApi.restore(this.card.id, version)\n notify({ level: 'info', message: t('ai-dashboard.text.restored', { version }) })\n dashboardChanged()\n this.dispatchEvent(new CustomEvent('done', { bubbles: true, composed: true }))\n } catch (error: any) {\n notify({ level: 'error', message: error?.message ?? String(error) })\n }\n }\n}\n\n/* 'fit' is the house size of a form of a few fields - it stands at its own height; a small popup was narrower than the form. */\nfunction open(template: unknown, title: string, size: 'fit' | 'medium' = 'fit') {\n const popup: any = openPopup(html`<div @done=${() => popup?.close?.()}>${template}</div>`, { backdrop: true, size, title })\n return popup\n}\n\nexport const openCardAiPrompt = (card: CardItem) => open(html`<ai-dashboard-card-ai-form .card=${card}></ai-dashboard-card-ai-form>`, t('ai-dashboard.card.ai'), 'medium')\nexport const openCardRename = (card: CardItem) => open(html`<ai-dashboard-card-rename-form .card=${card}></ai-dashboard-card-rename-form>`, t('ai-dashboard.card.rename'))\nexport const openCardShare = (card: CardItem) => open(html`<ai-dashboard-card-share-form .card=${card}></ai-dashboard-card-share-form>`, t('ai-dashboard.share.title', { name: card.name }), 'medium')\nexport const openCardVersions = (card: CardItem) => open(html`<ai-dashboard-card-versions .card=${card}></ai-dashboard-card-versions>`, t('ai-dashboard.card.versions'), 'medium')\n"]}
|
|
1
|
+
{"version":3,"file":"card-dialogs.js","sourceRoot":"","sources":["../../client/components/card-dialogs.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,OAAO,4BAA4B,CAAA;AACnC,OAAO,uCAAuC,CAAA;AAC9C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,oCAAoC,CAAA;AAE3C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,eAAe,EAAE,MAA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,CAAA;IAC3H,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAc,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAA,oCAAoC,IAAI,+BAA+B,EAAE,CAAC,CAAC,sBAAsB,CAAC,EAAE,QAAQ,CAAC,CAAA;AAC1K,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAc,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAA,wCAAwC,IAAI,mCAAmC,EAAE,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAA;AAC1K,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAc,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAA,uCAAuC,IAAI,kCAAkC,EAAE,CAAC,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAA;AACtM,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAc,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAA,qCAAqC,IAAI,gCAAgC,EAAE,CAAC,CAAC,4BAA4B,CAAC,EAAE,QAAQ,CAAC,CAAA","sourcesContent":["/*\n * The small forms a card opens - what to change with the assistant, a new name, whom to share it with, and its\n * versions (ADR-0160 decisions 7, 9). Each changes one card through its own door and tells an open dashboard.\n */\nimport '@material/web/icon/icon.js'\nimport '@material/web/button/filled-button.js'\nimport '@material/web/button/text-button.js'\nimport '@operato/popup/ox-popup-actions.js'\n\nimport gql from 'graphql-tag'\nimport { LitElement, css, html, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { QueryController } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { CommonPopupStyles, PopupBodyStyles } from '@operato/styles'\nimport { askAssistant } from '@things-factory/ai-assistant/dist-client/index.js'\n\nimport { cardApi, dashboardChanged, type CardItem, type CardShare, type CardVersion, type ShareOptions } from '../utils/card-api.js'\nimport { cardSelection } from '../utils/card-words.js'\n\nconst t = (key: string, options: Record<string, unknown> = {}) => String(i18next.t(key, options))\n\n/*\n * The house popup (CommonPopupStyles, PopupBodyStyles): only .body scrolls and ox-popup-actions stays put - a share\n * list of three people pushed 저장 out of sight (2026-10-25). The form fills the popup it is opened in.\n */\nconst FormStyles = css`\n :host {\n height: 100%;\n line-height: 1.5;\n }\n\n p.lead,\n p.note {\n margin: 0;\n }\n\n p.lead {\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n }\n\n textarea,\n input[type='text'],\n input[type='search'] {\n box-sizing: border-box;\n width: 100%;\n padding: 9px 12px;\n border: 1px solid var(--ui-line, var(--md-sys-color-outline-variant));\n border-radius: 8px;\n background: var(--ui-panel, var(--md-sys-color-surface-container-lowest));\n color: inherit;\n font: inherit;\n }\n\n textarea {\n min-height: 88px;\n resize: vertical;\n }\n\n textarea:focus,\n input:focus {\n outline: 2px solid color-mix(in srgb, var(--ui-accent, var(--md-sys-color-primary)) 40%, transparent);\n border-color: var(--ui-accent, var(--md-sys-color-primary));\n }\n\n .hints {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n }\n\n .hints button {\n padding: 4px 10px;\n border: 1px solid var(--ui-line, var(--md-sys-color-outline-variant));\n border-radius: 999px;\n background: transparent;\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n font: inherit;\n font-size: var(--ui-t-small, 12px);\n cursor: pointer;\n }\n\n .hints button:hover {\n border-color: var(--ui-accent, var(--md-sys-color-primary));\n color: var(--ui-accent, var(--md-sys-color-primary));\n }\n\n h5 {\n margin: 6px 0 0;\n font-size: var(--ui-t-small, 12px);\n font-weight: 600;\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n text-transform: none;\n }\n\n label.option {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 8px 10px;\n border: 1px solid var(--ui-line-soft, var(--md-sys-color-outline-variant));\n border-radius: 8px;\n cursor: pointer;\n }\n\n label.option small {\n margin-left: auto;\n color: var(--ui-faint, var(--md-sys-color-on-surface-variant));\n }\n\n .people {\n display: flex;\n flex-direction: column;\n gap: 6px;\n }\n\n .person {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 6px 10px;\n border-radius: 8px;\n background: var(--ui-panel-2, var(--md-sys-color-surface-container-low));\n --md-icon-size: 16px;\n }\n\n .person small {\n color: var(--ui-faint, var(--md-sys-color-on-surface-variant));\n }\n\n .person button,\n .found button {\n margin-left: auto;\n border: 0;\n background: transparent;\n color: var(--ui-accent, var(--md-sys-color-primary));\n font: inherit;\n cursor: pointer;\n }\n\n .found {\n display: flex;\n flex-direction: column;\n border: 1px solid var(--ui-line-soft, var(--md-sys-color-outline-variant));\n border-radius: 8px;\n }\n\n .found div {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 6px 10px;\n }\n\n .found div + div {\n border-top: 1px solid var(--ui-line-soft, var(--md-sys-color-outline-variant));\n }\n\n ol.versions {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n gap: 6px;\n }\n\n ol.versions li {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 10px 12px;\n border: 1px solid var(--ui-line-soft, var(--md-sys-color-outline-variant));\n border-radius: 8px;\n }\n\n ol.versions .v {\n flex: none;\n min-width: 36px;\n font-weight: 650;\n font-variant-numeric: tabular-nums;\n color: var(--ui-accent, var(--md-sys-color-primary));\n }\n\n ol.versions .label {\n flex: 1;\n min-width: 0;\n }\n\n ol.versions small {\n display: block;\n color: var(--ui-faint, var(--md-sys-color-on-surface-variant));\n }\n`\n\n/** What to change in a card - sent to the conversation beside the page with the card picked, as a screen request. */\n@customElement('ai-dashboard-card-ai-form')\nexport class CardAiForm extends localize(i18next)(LitElement) {\n static styles = [CommonPopupStyles, PopupBodyStyles, FormStyles]\n @property({ attribute: false }) card!: CardItem\n @state() private text = ''\n\n render() {\n const hints = ['ai-dashboard.ai.hint-period', 'ai-dashboard.ai.hint-top', 'ai-dashboard.ai.hint-line', 'ai-dashboard.ai.hint-table']\n return html`<div class=\"body\">\n <p class=\"lead\">${t('ai-dashboard.ai.lead', { name: this.card.name })}</p>\n <textarea .value=${this.text} placeholder=${t('ai-dashboard.ai.placeholder')} @input=${(e: any) => (this.text = e.target.value)} @keydown=${(e: KeyboardEvent) => e.key === 'Enter' && (e.metaKey || e.ctrlKey) && this.send()}></textarea>\n <div class=\"hints\">${hints.map(key => html`<button @click=${() => (this.text = t(key))}>${t(key)}</button>`)}</div>\n </div>\n <ox-popup-actions>\n <md-text-button slot=\"cancel\" @click=${() => this.close()}>${t('ai-dashboard.button.cancel')}</md-text-button>\n <md-filled-button slot=\"confirm\" ?disabled=${!this.text.trim()} @click=${() => this.send()}>${t('ai-dashboard.ai.send')}</md-filled-button>\n </ox-popup-actions>`\n }\n\n private close() {\n this.dispatchEvent(new CustomEvent('done', { bubbles: true, composed: true }))\n }\n\n private send() {\n if (!this.text.trim()) return\n /* Closed first: the dock opens over the page, and a popup that is no longer the top one refuses to close. */\n this.close()\n askAssistant({\n ask: t('ai-dashboard.ai.ask', { name: this.card.name, version: this.card.version, change: this.text.trim() }),\n selection: cardSelection(this.card, t('ai-dashboard.title'))\n })\n }\n}\n\n/** A card's new name - a new version. */\n@customElement('ai-dashboard-card-rename-form')\nexport class CardRenameForm extends localize(i18next)(LitElement) {\n static styles = [CommonPopupStyles, PopupBodyStyles, FormStyles]\n @property({ attribute: false }) card!: CardItem\n @state() private name = ''\n\n connectedCallback() {\n super.connectedCallback()\n this.name = this.card?.name ?? ''\n }\n\n render() {\n return html`<div class=\"body\">\n <input type=\"text\" .value=${this.name} maxlength=\"100\" @input=${(e: any) => (this.name = e.target.value)} @keydown=${(e: KeyboardEvent) => e.key === 'Enter' && this.save()} />\n </div>\n <ox-popup-actions>\n <md-text-button slot=\"cancel\" @click=${() => this.close()}>${t('ai-dashboard.button.cancel')}</md-text-button>\n <md-filled-button slot=\"confirm\" ?disabled=${!this.name.trim() || this.name.trim() === this.card.name} @click=${() => this.save()}>${t('ai-dashboard.button.save')}</md-filled-button>\n </ox-popup-actions>`\n }\n\n private close() {\n this.dispatchEvent(new CustomEvent('done', { bubbles: true, composed: true }))\n }\n\n private async save() {\n try {\n await cardApi.rename(this.card.id, this.name.trim())\n dashboardChanged()\n this.close()\n } catch (error: any) {\n notify({ level: 'error', message: error?.message ?? String(error) })\n }\n }\n}\n\n/** Whom one's own card is shared with - the whole domain, one's own departments, people found by name. */\n@customElement('ai-dashboard-card-share-form')\nexport class CardShareForm extends localize(i18next)(LitElement) {\n static styles = [CommonPopupStyles, PopupBodyStyles, FormStyles]\n @property({ attribute: false }) card!: CardItem\n @state() private shares: CardShare[] = []\n @state() private search = ''\n /** The name the people are found by - the typed text once typing pauses. */\n @state() private findBy = ''\n private searching?: ReturnType<typeof setTimeout>\n\n private optionsRead = new QueryController(\n this,\n gql`query { dashboardShareOptions { domainId domainName departments { id name } peopleAvailable roles { id name note } } }`\n )\n private peopleRead = new QueryController(this, gql`query ($text: String!) { dashboardSharePeople(text: $text) { id name note } }`, {\n variables: () => (this.findBy ? { text: this.findBy } : undefined)\n })\n\n private get options(): ShareOptions | undefined {\n return this.optionsRead.data?.dashboardShareOptions\n }\n\n private get found(): { id: string; name: string; note?: string }[] {\n return this.peopleRead.data?.dashboardSharePeople ?? []\n }\n\n connectedCallback() {\n super.connectedCallback()\n this.shares = [...(this.card?.shares ?? [])].map(({ scope, targetId, targetName }) => ({ scope, targetId, targetName }))\n }\n\n private has(scope: string, id: string) {\n return this.shares.some(one => one.scope === scope && one.targetId === id)\n }\n\n private toggle(share: CardShare, on: boolean) {\n this.shares = on ? [...this.shares.filter(one => !(one.scope === share.scope && one.targetId === share.targetId)), share] : this.shares.filter(one => !(one.scope === share.scope && one.targetId === share.targetId))\n }\n\n private find(text: string) {\n this.search = text\n clearTimeout(this.searching)\n this.searching = setTimeout(() => (this.findBy = text.trim()), 250)\n }\n\n render() {\n const options = this.options\n const people = this.shares.filter(one => one.scope === 'USER')\n return html`<div class=\"body\">\n <p class=\"lead\">${t('ai-dashboard.share.lead')}</p>\n ${options\n ? html`<h5>${t('ai-dashboard.share.everyone-title')}</h5>\n <label class=\"option\">\n <input type=\"checkbox\" .checked=${this.has('DOMAIN', options.domainId)} @change=${(e: any) => this.toggle({ scope: 'DOMAIN', targetId: options.domainId, targetName: options.domainName }, e.target.checked)} />\n <md-icon>domain</md-icon>${t('ai-dashboard.share.everyone-in', { name: options.domainName })}\n </label>\n ${options.departments.length\n ? html`<h5>${t('ai-dashboard.share.departments')}</h5>\n ${options.departments.map(\n one => html`<label class=\"option\">\n <input type=\"checkbox\" .checked=${this.has('DEPARTMENT', one.id)} @change=${(e: any) => this.toggle({ scope: 'DEPARTMENT', targetId: one.id, targetName: one.name }, e.target.checked)} />\n <md-icon>groups</md-icon>${one.name}<small>${t('ai-dashboard.share.department-members')}</small>\n </label>`\n )}`\n : nothing}\n ${options.roles.length\n ? html`<h5>${t('ai-dashboard.share.roles')}</h5>\n ${options.roles.map(\n one => html`<label class=\"option\">\n <input type=\"checkbox\" .checked=${this.has('ROLE', one.id)} @change=${(e: any) => this.toggle({ scope: 'ROLE', targetId: one.id, targetName: one.name }, e.target.checked)} />\n <md-icon>badge</md-icon>${one.name}<small>${t('ai-dashboard.share.role-holders')}</small>\n </label>`\n )}`\n : nothing}\n <h5>${t('ai-dashboard.share.people')}</h5>\n ${people.length\n ? html`<div class=\"people\">\n ${people.map(one => html`<div class=\"person\"><md-icon>person</md-icon>${one.targetName ?? one.targetId}<button @click=${() => this.toggle(one, false)}>${t('ai-dashboard.share.remove')}</button></div>`)}\n </div>`\n : nothing}\n ${options.peopleAvailable\n ? html`<input type=\"search\" .value=${this.search} placeholder=${t('ai-dashboard.share.find-person')} @input=${(e: any) => this.find(e.target.value)} />\n ${this.found.length\n ? html`<div class=\"found\">\n ${this.found\n .filter(one => !this.has('USER', one.id))\n .map(one => html`<div><md-icon>person_add</md-icon>${one.name} ${one.note ? html`<small>${one.note}</small>` : nothing}<button @click=${() => this.toggle({ scope: 'USER', targetId: one.id, targetName: one.name }, true)}>${t('ai-dashboard.share.add')}</button></div>`)}\n </div>`\n : nothing}`\n : html`<p class=\"note\">${t('ai-dashboard.share.people-unavailable')}</p>`}\n <p class=\"note\">${t('ai-dashboard.share.rule')}</p>`\n : nothing}\n </div>\n <ox-popup-actions>\n <md-text-button slot=\"cancel\" @click=${() => this.close()}>${t('ai-dashboard.button.cancel')}</md-text-button>\n <md-filled-button slot=\"confirm\" ?disabled=${!options} @click=${() => this.save()}>${t('ai-dashboard.button.save')}</md-filled-button>\n </ox-popup-actions>`\n }\n\n private close() {\n this.dispatchEvent(new CustomEvent('done', { bubbles: true, composed: true }))\n }\n\n private async save() {\n try {\n await cardApi.share(this.card.id, this.shares)\n notify({ level: 'info', message: t(this.shares.length ? 'ai-dashboard.text.shared' : 'ai-dashboard.text.private', { name: this.card.name }) })\n dashboardChanged()\n this.close()\n } catch (error: any) {\n notify({ level: 'error', message: error?.message ?? String(error) })\n }\n }\n}\n\n/** One's own card's versions, newest first - an earlier one comes back as a new version. */\n@customElement('ai-dashboard-card-versions')\nexport class CardVersions extends localize(i18next)(LitElement) {\n static styles = [CommonPopupStyles, PopupBodyStyles, FormStyles]\n @property({ attribute: false }) card!: CardItem\n\n private versionsRead = new QueryController(\n this,\n gql`query ($id: String!) { dashboardCardVersions(id: $id) { version name definition creatorName createdAt } }`,\n { variables: () => (this.card ? { id: this.card.id } : undefined) }\n )\n\n private get versions(): CardVersion[] | undefined {\n return this.versionsRead.data?.dashboardCardVersions\n }\n\n render() {\n const view = (definition: any) => t(`ai-dashboard.view.${definition?.view?.kind ?? 'table'}`)\n return html`<div class=\"body\">\n <p class=\"lead\">${t('ai-dashboard.versions.lead')}</p>\n <ol class=\"versions\">\n ${(this.versions ?? []).map(\n one => html`<li>\n <span class=\"v\">v${one.version}</span>\n <span class=\"label\">${one.name}<small>${view(one.definition)} · ${one.creatorName ?? ''} · ${one.createdAt ? new Date(one.createdAt).toLocaleString(i18next.language) : ''}</small></span>\n ${one.version === this.card.version\n ? html`<small>${t('ai-dashboard.versions.current')}</small>`\n : html`<md-text-button @click=${() => this.restore(one.version)}>${t('ai-dashboard.versions.restore')}</md-text-button>`}\n </li>`\n )}\n </ol>\n </div>`\n }\n\n private async restore(version: number) {\n try {\n await cardApi.restore(this.card.id, version)\n notify({ level: 'info', message: t('ai-dashboard.text.restored', { version }) })\n dashboardChanged()\n this.dispatchEvent(new CustomEvent('done', { bubbles: true, composed: true }))\n } catch (error: any) {\n notify({ level: 'error', message: error?.message ?? String(error) })\n }\n }\n}\n\n/* 'fit' is the house size of a form of a few fields - it stands at its own height; a small popup was narrower than the form. */\nfunction open(template: unknown, title: string, size: 'fit' | 'medium' = 'fit') {\n const popup: any = openPopup(html`<div @done=${() => popup?.close?.()}>${template}</div>`, { backdrop: true, size, title })\n return popup\n}\n\nexport const openCardAiPrompt = (card: CardItem) => open(html`<ai-dashboard-card-ai-form .card=${card}></ai-dashboard-card-ai-form>`, t('ai-dashboard.card.ai'), 'medium')\nexport const openCardRename = (card: CardItem) => open(html`<ai-dashboard-card-rename-form .card=${card}></ai-dashboard-card-rename-form>`, t('ai-dashboard.card.rename'))\nexport const openCardShare = (card: CardItem) => open(html`<ai-dashboard-card-share-form .card=${card}></ai-dashboard-card-share-form>`, t('ai-dashboard.share.title', { name: card.name }), 'medium')\nexport const openCardVersions = (card: CardItem) => open(html`<ai-dashboard-card-versions .card=${card}></ai-dashboard-card-versions>`, t('ai-dashboard.card.versions'), 'medium')\n"]}
|
|
@@ -6,12 +6,12 @@ declare const CardLibrary_base: (new (...args: any[]) => LitElement) & typeof Li
|
|
|
6
6
|
export declare class CardLibrary extends CardLibrary_base {
|
|
7
7
|
static styles: import("lit").CSSResult[];
|
|
8
8
|
private which;
|
|
9
|
-
private
|
|
10
|
-
private
|
|
9
|
+
private library;
|
|
10
|
+
private get cards();
|
|
11
|
+
private get error();
|
|
11
12
|
private onChanged;
|
|
12
13
|
connectedCallback(): void;
|
|
13
14
|
disconnectedCallback(): void;
|
|
14
|
-
private load;
|
|
15
15
|
private show;
|
|
16
16
|
render(): import("lit-html").TemplateResult<1>;
|
|
17
17
|
private renderCard;
|
|
@@ -6,13 +6,15 @@ import { __decorate, __metadata } from "tslib";
|
|
|
6
6
|
import '@material/web/icon/icon.js';
|
|
7
7
|
import '@material/web/button/filled-tonal-button.js';
|
|
8
8
|
import '@material/web/button/text-button.js';
|
|
9
|
+
import gql from 'graphql-tag';
|
|
9
10
|
import { LitElement, css, html, nothing } from 'lit';
|
|
10
11
|
import { customElement, state } from 'lit/decorators.js';
|
|
12
|
+
import { QueryController } from '@operato/graphql';
|
|
11
13
|
import { i18next, localize } from '@operato/i18n';
|
|
12
14
|
import { ScrollbarStyles } from '@operato/styles';
|
|
13
15
|
import { notify } from '@operato/layout';
|
|
14
16
|
import { OxPrompt } from '@operato/popup/ox-prompt.js';
|
|
15
|
-
import { cardApi, DASHBOARD_CHANGED, dashboardChanged } from '../utils/card-api.js';
|
|
17
|
+
import { cardApi, CARD_FIELDS, DASHBOARD_CHANGED, dashboardChanged } from '../utils/card-api.js';
|
|
16
18
|
import { ownershipLine, viewIcon } from '../utils/card-words.js';
|
|
17
19
|
import { openCardRename, openCardShare, openCardVersions } from './card-dialogs.js';
|
|
18
20
|
const t = (key, options = {}) => String(i18next.t(key, options));
|
|
@@ -20,7 +22,9 @@ let CardLibrary = class CardLibrary extends localize(i18next)(LitElement) {
|
|
|
20
22
|
constructor() {
|
|
21
23
|
super(...arguments);
|
|
22
24
|
this.which = 'mine';
|
|
23
|
-
|
|
25
|
+
/* The tab's cards (ADR-0190); a change told from elsewhere reads them again. */
|
|
26
|
+
this.library = new QueryController(this, gql `query ($which: String!) { dashboardCards(which: $which) { ${CARD_FIELDS} } }`, { variables: () => ({ which: this.which }) });
|
|
27
|
+
this.onChanged = () => this.library.refetch();
|
|
24
28
|
}
|
|
25
29
|
static { this.styles = [
|
|
26
30
|
ScrollbarStyles,
|
|
@@ -177,28 +181,23 @@ let CardLibrary = class CardLibrary extends localize(i18next)(LitElement) {
|
|
|
177
181
|
}
|
|
178
182
|
`
|
|
179
183
|
]; }
|
|
184
|
+
get cards() {
|
|
185
|
+
return this.library.data?.dashboardCards;
|
|
186
|
+
}
|
|
187
|
+
get error() {
|
|
188
|
+
const error = this.library.error;
|
|
189
|
+
return error ? (error.message ?? String(error)) : undefined;
|
|
190
|
+
}
|
|
180
191
|
connectedCallback() {
|
|
181
192
|
super.connectedCallback();
|
|
182
193
|
window.addEventListener(DASHBOARD_CHANGED, this.onChanged);
|
|
183
|
-
this.load();
|
|
184
194
|
}
|
|
185
195
|
disconnectedCallback() {
|
|
186
196
|
window.removeEventListener(DASHBOARD_CHANGED, this.onChanged);
|
|
187
197
|
super.disconnectedCallback();
|
|
188
198
|
}
|
|
189
|
-
async load() {
|
|
190
|
-
try {
|
|
191
|
-
this.cards = await cardApi.library(this.which);
|
|
192
|
-
this.error = undefined;
|
|
193
|
-
}
|
|
194
|
-
catch (error) {
|
|
195
|
-
this.error = error?.message ?? String(error);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
199
|
show(which) {
|
|
199
200
|
this.which = which;
|
|
200
|
-
this.cards = undefined;
|
|
201
|
-
this.load();
|
|
202
201
|
}
|
|
203
202
|
render() {
|
|
204
203
|
return html `<div class="tabs" role="tablist">
|
|
@@ -270,14 +269,6 @@ __decorate([
|
|
|
270
269
|
state(),
|
|
271
270
|
__metadata("design:type", String)
|
|
272
271
|
], CardLibrary.prototype, "which", void 0);
|
|
273
|
-
__decorate([
|
|
274
|
-
state(),
|
|
275
|
-
__metadata("design:type", Array)
|
|
276
|
-
], CardLibrary.prototype, "cards", void 0);
|
|
277
|
-
__decorate([
|
|
278
|
-
state(),
|
|
279
|
-
__metadata("design:type", String)
|
|
280
|
-
], CardLibrary.prototype, "error", void 0);
|
|
281
272
|
CardLibrary = __decorate([
|
|
282
273
|
customElement('ai-dashboard-card-library')
|
|
283
274
|
], CardLibrary);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card-library.js","sourceRoot":"","sources":["../../client/components/card-library.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,OAAO,4BAA4B,CAAA;AACnC,OAAO,6CAA6C,CAAA;AACpD,OAAO,qCAAqC,CAAA;AAE5C,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAEtD,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAiB,MAAM,sBAAsB,CAAA;AAClG,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEnF,MAAM,CAAC,GAAG,CAAC,GAAW,EAAE,UAAmC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAA;AAG1F,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAAvD;;QA6JY,UAAK,GAAsB,MAAM,CAAA;QAI1C,cAAS,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAA;IAgGvC,CAAC;aAhQQ,WAAM,GAAG;QACd,eAAe;QACf,GAAG,CAAA;;;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4B;QAChD,IAAI,CAAC;YACH,MAAM,IAAI,EAAE,CAAA;YACZ,gBAAgB,EAAE,CAAA;QACpB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QACtE,CAAC;IACH,CAAC;;AAnGgB;IAAhB,KAAK,EAAE;;0CAA0C;AACjC;IAAhB,KAAK,EAAE;;0CAA2B;AAClB;IAAhB,KAAK,EAAE;;0CAAuB;AA/JpB,WAAW;IADvB,aAAa,CAAC,2BAA2B,CAAC;GAC9B,WAAW,CAiQvB","sourcesContent":["/*\n * The card library - one's own cards and those shared with one (ADR-0160 decision 7). A card is placed on the\n * dashboard from here, shared, copied, renamed, taken back to an earlier version or deleted by its owner.\n */\nimport '@material/web/icon/icon.js'\nimport '@material/web/button/filled-tonal-button.js'\nimport '@material/web/button/text-button.js'\n\nimport { LitElement, css, html, nothing } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { notify } from '@operato/layout'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\n\nimport { cardApi, DASHBOARD_CHANGED, dashboardChanged, type CardItem } from '../utils/card-api.js'\nimport { ownershipLine, viewIcon } from '../utils/card-words.js'\nimport { openCardRename, openCardShare, openCardVersions } from './card-dialogs.js'\n\nconst t = (key: string, options: Record<string, unknown> = {}) => String(i18next.t(key, options))\n\n@customElement('ai-dashboard-card-library')\nexport class CardLibrary extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n /* As tall as the popup, which clips what is past it - the list scrolls in it (2026-10-25: the lower cards were cut). */\n :host {\n display: flex;\n flex-direction: column;\n gap: 12px;\n box-sizing: border-box;\n height: 100%;\n overflow-y: auto;\n padding: 12px 20px 20px;\n color: var(--ui-ink, var(--md-sys-color-on-surface));\n font-size: var(--ui-t-body, 13px);\n line-height: 1.5;\n }\n\n .tabs {\n display: flex;\n gap: 4px;\n padding: 3px;\n border-radius: 10px;\n background: var(--ui-panel-2, var(--md-sys-color-surface-container));\n align-self: flex-start;\n }\n\n .tabs button {\n padding: 6px 14px;\n border: 0;\n border-radius: 8px;\n background: transparent;\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n font: inherit;\n font-weight: 600;\n cursor: pointer;\n }\n\n .tabs button[aria-selected='true'] {\n background: var(--ui-panel, var(--md-sys-color-surface-container-lowest));\n color: var(--ui-ink, var(--md-sys-color-on-surface));\n box-shadow: 0 1px 3px rgb(0 0 0 / 12%);\n }\n\n ul {\n flex-shrink: 0;\n list-style: none;\n margin: 0;\n padding: 0;\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));\n gap: 10px;\n }\n\n li {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 14px;\n border: 1px solid var(--ui-line, var(--md-sys-color-outline-variant));\n border-radius: 12px;\n background: var(--ui-panel, var(--md-sys-color-surface-container-lowest));\n }\n\n .head {\n display: flex;\n gap: 10px;\n align-items: flex-start;\n }\n\n .kind {\n flex: none;\n display: grid;\n place-items: center;\n width: 32px;\n height: 32px;\n border-radius: 8px;\n background: var(--ui-accent-wash, color-mix(in srgb, var(--md-sys-color-primary) 12%, transparent));\n color: var(--ui-accent, var(--md-sys-color-primary));\n --md-icon-size: 18px;\n }\n\n .names {\n flex: 1;\n min-width: 0;\n }\n\n .names strong {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .names small {\n display: block;\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n }\n\n .badge {\n flex: none;\n padding: 1px 8px;\n border-radius: 999px;\n background: var(--ui-panel-2, var(--md-sys-color-surface-container));\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n font-size: var(--ui-t-micro, 11px);\n font-variant-numeric: tabular-nums;\n }\n\n .row {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 2px;\n }\n\n .row .placed {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n margin-right: auto;\n color: var(--ui-good, #2e7d32);\n font-size: var(--ui-t-small, 12px);\n --md-icon-size: 16px;\n }\n\n .row .spacer {\n margin-right: auto;\n }\n\n button.icon {\n display: grid;\n place-items: center;\n width: 30px;\n height: 30px;\n padding: 0;\n border: 0;\n border-radius: 8px;\n background: transparent;\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n cursor: pointer;\n --md-icon-size: 18px;\n }\n\n button.icon:hover {\n background: var(--ui-hover, var(--md-sys-color-surface-container-high));\n color: var(--ui-ink, var(--md-sys-color-on-surface));\n }\n\n .empty {\n padding: 36px 12px;\n text-align: center;\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n }\n `\n ]\n\n @state() private which: 'mine' | 'shared' = 'mine'\n @state() private cards?: CardItem[]\n @state() private error?: string\n\n private onChanged = () => this.load()\n\n connectedCallback() {\n super.connectedCallback()\n window.addEventListener(DASHBOARD_CHANGED, this.onChanged)\n this.load()\n }\n\n disconnectedCallback() {\n window.removeEventListener(DASHBOARD_CHANGED, this.onChanged)\n super.disconnectedCallback()\n }\n\n private async load() {\n try {\n this.cards = await cardApi.library(this.which)\n this.error = undefined\n } catch (error: any) {\n this.error = error?.message ?? String(error)\n }\n }\n\n private show(which: 'mine' | 'shared') {\n this.which = which\n this.cards = undefined\n this.load()\n }\n\n render() {\n return html`<div class=\"tabs\" role=\"tablist\">\n <button role=\"tab\" aria-selected=${this.which === 'mine' ? 'true' : 'false'} @click=${() => this.show('mine')}>${t('ai-dashboard.library.mine')}</button>\n <button role=\"tab\" aria-selected=${this.which === 'shared' ? 'true' : 'false'} @click=${() => this.show('shared')}>${t('ai-dashboard.library.shared')}</button>\n </div>\n ${this.error ? html`<p class=\"empty\">${this.error}</p>` : nothing}\n ${this.cards && !this.cards.length ? html`<p class=\"empty\">${t(this.which === 'mine' ? 'ai-dashboard.library.none-mine' : 'ai-dashboard.library.none-shared')}</p>` : nothing}\n <ul>\n ${(this.cards ?? []).map(card => this.renderCard(card))}\n </ul>`\n }\n\n private renderCard(card: CardItem) {\n const owner = card.access === 'owner'\n const icon = (action: () => unknown, name: string, key: string) => html`<button class=\"icon\" title=${t(key)} aria-label=${t(key)} @click=${action}><md-icon>${name}</md-icon></button>`\n const line = [card.description, ownershipLine(card, t)].filter(Boolean).join(' · ')\n return html`<li>\n <div class=\"head\">\n <span class=\"kind\"><md-icon>${viewIcon(card.definition)}</md-icon></span>\n <span class=\"names\"><strong title=${card.name}>${card.name}</strong>${line ? html`<small>${line}</small>` : nothing}</span>\n <span class=\"badge\">v${card.version}</span>\n </div>\n <div class=\"row\">\n ${card.placed\n ? html`<span class=\"placed\"><md-icon>check_circle</md-icon>${t('ai-dashboard.library.placed')}</span>`\n : html`<md-filled-tonal-button @click=${() => this.place(card)}>${t('ai-dashboard.library.place')}</md-filled-tonal-button><span class=\"spacer\"></span>`}\n ${owner ? icon(() => openCardShare(card), 'share', 'ai-dashboard.card.share') : nothing}\n ${owner ? icon(() => openCardRename(card), 'edit', 'ai-dashboard.card.rename') : nothing}\n ${owner ? icon(() => openCardVersions(card), 'history', 'ai-dashboard.card.versions') : nothing}\n ${icon(() => this.copy(card), 'content_copy', owner ? 'ai-dashboard.card.duplicate' : 'ai-dashboard.card.copy')}\n ${owner ? icon(() => this.deleteCard(card), 'delete_outline', 'ai-dashboard.card.delete') : nothing}\n </div>\n </li>`\n }\n\n private async place(card: CardItem) {\n await this.attempt(async () => {\n await cardApi.place(card.id)\n notify({ level: 'info', message: t('ai-dashboard.text.placed', { name: card.name }) })\n })\n }\n\n private async copy(card: CardItem) {\n await this.attempt(async () => {\n await cardApi.copy(card.id)\n notify({ level: 'info', message: t('ai-dashboard.text.copied', { name: card.name }) })\n })\n }\n\n private async deleteCard(card: CardItem) {\n const sure = await OxPrompt.open({\n title: t('ai-dashboard.card.delete'),\n text: t(card.shares?.length ? 'ai-dashboard.text.delete-shared' : 'ai-dashboard.text.delete', { name: card.name }),\n confirmButton: { text: t('ai-dashboard.card.delete') },\n cancelButton: { text: t('ai-dashboard.button.cancel') }\n })\n if (!sure) return\n await this.attempt(() => cardApi.remove(card.id))\n }\n\n private async attempt(work: () => Promise<unknown>) {\n try {\n await work()\n dashboardChanged()\n } catch (error: any) {\n notify({ level: 'error', message: error?.message ?? String(error) })\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"card-library.js","sourceRoot":"","sources":["../../client/components/card-library.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,OAAO,4BAA4B,CAAA;AACnC,OAAO,6CAA6C,CAAA;AACpD,OAAO,qCAAqC,CAAA;AAE5C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAEtD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,EAAiB,MAAM,sBAAsB,CAAA;AAC/G,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEnF,MAAM,CAAC,GAAG,CAAC,GAAW,EAAE,UAAmC,EAAE,EAAE,EAAE,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AAC,CAAC,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;YAClH,aAAa,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,0BAA0B,CAAC,EAAE;YACtD,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,4BAA4B,CAAC,EAAE;SACxD,CAAC,CAAA;QACF,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;IACnD,CAAC;IAEO,KAAK,CAAC,OAAO,CAAC,IAA4B;QAChD,IAAI,CAAC;YACH,MAAM,IAAI,EAAE,CAAA;YACZ,gBAAgB,EAAE,CAAA;QACpB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QACtE,CAAC;IACH,CAAC;;AArGgB;IAAhB,KAAK,EAAE;;0CAA0C;AA7JvC,WAAW;IADvB,aAAa,CAAC,2BAA2B,CAAC;GAC9B,WAAW,CAmQvB","sourcesContent":["/*\n * The card library - one's own cards and those shared with one (ADR-0160 decision 7). A card is placed on the\n * dashboard from here, shared, copied, renamed, taken back to an earlier version or deleted by its owner.\n */\nimport '@material/web/icon/icon.js'\nimport '@material/web/button/filled-tonal-button.js'\nimport '@material/web/button/text-button.js'\n\nimport gql from 'graphql-tag'\nimport { LitElement, css, html, nothing } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\n\nimport { QueryController } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { notify } from '@operato/layout'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\n\nimport { cardApi, CARD_FIELDS, DASHBOARD_CHANGED, dashboardChanged, type CardItem } from '../utils/card-api.js'\nimport { ownershipLine, viewIcon } from '../utils/card-words.js'\nimport { openCardRename, openCardShare, openCardVersions } from './card-dialogs.js'\n\nconst t = (key: string, options: Record<string, unknown> = {}) => String(i18next.t(key, options))\n\n@customElement('ai-dashboard-card-library')\nexport class CardLibrary extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n /* As tall as the popup, which clips what is past it - the list scrolls in it (2026-10-25: the lower cards were cut). */\n :host {\n display: flex;\n flex-direction: column;\n gap: 12px;\n box-sizing: border-box;\n height: 100%;\n overflow-y: auto;\n padding: 12px 20px 20px;\n color: var(--ui-ink, var(--md-sys-color-on-surface));\n font-size: var(--ui-t-body, 13px);\n line-height: 1.5;\n }\n\n .tabs {\n display: flex;\n gap: 4px;\n padding: 3px;\n border-radius: 10px;\n background: var(--ui-panel-2, var(--md-sys-color-surface-container));\n align-self: flex-start;\n }\n\n .tabs button {\n padding: 6px 14px;\n border: 0;\n border-radius: 8px;\n background: transparent;\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n font: inherit;\n font-weight: 600;\n cursor: pointer;\n }\n\n .tabs button[aria-selected='true'] {\n background: var(--ui-panel, var(--md-sys-color-surface-container-lowest));\n color: var(--ui-ink, var(--md-sys-color-on-surface));\n box-shadow: 0 1px 3px rgb(0 0 0 / 12%);\n }\n\n ul {\n flex-shrink: 0;\n list-style: none;\n margin: 0;\n padding: 0;\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));\n gap: 10px;\n }\n\n li {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 14px;\n border: 1px solid var(--ui-line, var(--md-sys-color-outline-variant));\n border-radius: 12px;\n background: var(--ui-panel, var(--md-sys-color-surface-container-lowest));\n }\n\n .head {\n display: flex;\n gap: 10px;\n align-items: flex-start;\n }\n\n .kind {\n flex: none;\n display: grid;\n place-items: center;\n width: 32px;\n height: 32px;\n border-radius: 8px;\n background: var(--ui-accent-wash, color-mix(in srgb, var(--md-sys-color-primary) 12%, transparent));\n color: var(--ui-accent, var(--md-sys-color-primary));\n --md-icon-size: 18px;\n }\n\n .names {\n flex: 1;\n min-width: 0;\n }\n\n .names strong {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .names small {\n display: block;\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n }\n\n .badge {\n flex: none;\n padding: 1px 8px;\n border-radius: 999px;\n background: var(--ui-panel-2, var(--md-sys-color-surface-container));\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n font-size: var(--ui-t-micro, 11px);\n font-variant-numeric: tabular-nums;\n }\n\n .row {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 2px;\n }\n\n .row .placed {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n margin-right: auto;\n color: var(--ui-good, #2e7d32);\n font-size: var(--ui-t-small, 12px);\n --md-icon-size: 16px;\n }\n\n .row .spacer {\n margin-right: auto;\n }\n\n button.icon {\n display: grid;\n place-items: center;\n width: 30px;\n height: 30px;\n padding: 0;\n border: 0;\n border-radius: 8px;\n background: transparent;\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n cursor: pointer;\n --md-icon-size: 18px;\n }\n\n button.icon:hover {\n background: var(--ui-hover, var(--md-sys-color-surface-container-high));\n color: var(--ui-ink, var(--md-sys-color-on-surface));\n }\n\n .empty {\n padding: 36px 12px;\n text-align: center;\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n }\n `\n ]\n\n @state() private which: 'mine' | 'shared' = 'mine'\n\n /* The tab's cards (ADR-0190); a change told from elsewhere reads them again. */\n private library = new QueryController(\n this,\n gql`query ($which: String!) { dashboardCards(which: $which) { ${CARD_FIELDS} } }`,\n { variables: () => ({ which: this.which }) }\n )\n\n private get cards(): CardItem[] | undefined {\n return this.library.data?.dashboardCards\n }\n\n private get error(): string | undefined {\n const error = this.library.error as any\n return error ? (error.message ?? String(error)) : undefined\n }\n\n private onChanged = () => this.library.refetch()\n\n connectedCallback() {\n super.connectedCallback()\n window.addEventListener(DASHBOARD_CHANGED, this.onChanged)\n }\n\n disconnectedCallback() {\n window.removeEventListener(DASHBOARD_CHANGED, this.onChanged)\n super.disconnectedCallback()\n }\n\n private show(which: 'mine' | 'shared') {\n this.which = which\n }\n\n render() {\n return html`<div class=\"tabs\" role=\"tablist\">\n <button role=\"tab\" aria-selected=${this.which === 'mine' ? 'true' : 'false'} @click=${() => this.show('mine')}>${t('ai-dashboard.library.mine')}</button>\n <button role=\"tab\" aria-selected=${this.which === 'shared' ? 'true' : 'false'} @click=${() => this.show('shared')}>${t('ai-dashboard.library.shared')}</button>\n </div>\n ${this.error ? html`<p class=\"empty\">${this.error}</p>` : nothing}\n ${this.cards && !this.cards.length ? html`<p class=\"empty\">${t(this.which === 'mine' ? 'ai-dashboard.library.none-mine' : 'ai-dashboard.library.none-shared')}</p>` : nothing}\n <ul>\n ${(this.cards ?? []).map(card => this.renderCard(card))}\n </ul>`\n }\n\n private renderCard(card: CardItem) {\n const owner = card.access === 'owner'\n const icon = (action: () => unknown, name: string, key: string) => html`<button class=\"icon\" title=${t(key)} aria-label=${t(key)} @click=${action}><md-icon>${name}</md-icon></button>`\n const line = [card.description, ownershipLine(card, t)].filter(Boolean).join(' · ')\n return html`<li>\n <div class=\"head\">\n <span class=\"kind\"><md-icon>${viewIcon(card.definition)}</md-icon></span>\n <span class=\"names\"><strong title=${card.name}>${card.name}</strong>${line ? html`<small>${line}</small>` : nothing}</span>\n <span class=\"badge\">v${card.version}</span>\n </div>\n <div class=\"row\">\n ${card.placed\n ? html`<span class=\"placed\"><md-icon>check_circle</md-icon>${t('ai-dashboard.library.placed')}</span>`\n : html`<md-filled-tonal-button @click=${() => this.place(card)}>${t('ai-dashboard.library.place')}</md-filled-tonal-button><span class=\"spacer\"></span>`}\n ${owner ? icon(() => openCardShare(card), 'share', 'ai-dashboard.card.share') : nothing}\n ${owner ? icon(() => openCardRename(card), 'edit', 'ai-dashboard.card.rename') : nothing}\n ${owner ? icon(() => openCardVersions(card), 'history', 'ai-dashboard.card.versions') : nothing}\n ${icon(() => this.copy(card), 'content_copy', owner ? 'ai-dashboard.card.duplicate' : 'ai-dashboard.card.copy')}\n ${owner ? icon(() => this.deleteCard(card), 'delete_outline', 'ai-dashboard.card.delete') : nothing}\n </div>\n </li>`\n }\n\n private async place(card: CardItem) {\n await this.attempt(async () => {\n await cardApi.place(card.id)\n notify({ level: 'info', message: t('ai-dashboard.text.placed', { name: card.name }) })\n })\n }\n\n private async copy(card: CardItem) {\n await this.attempt(async () => {\n await cardApi.copy(card.id)\n notify({ level: 'info', message: t('ai-dashboard.text.copied', { name: card.name }) })\n })\n }\n\n private async deleteCard(card: CardItem) {\n const sure = await OxPrompt.open({\n title: t('ai-dashboard.card.delete'),\n text: t(card.shares?.length ? 'ai-dashboard.text.delete-shared' : 'ai-dashboard.text.delete', { name: card.name }),\n confirmButton: { text: t('ai-dashboard.card.delete') },\n cancelButton: { text: t('ai-dashboard.button.cancel') }\n })\n if (!sure) return\n await this.attempt(() => cardApi.remove(card.id))\n }\n\n private async attempt(work: () => Promise<unknown>) {\n try {\n await work()\n dashboardChanged()\n } catch (error: any) {\n notify({ level: 'error', message: error?.message ?? String(error) })\n }\n }\n}\n"]}
|
|
@@ -14,13 +14,12 @@ export declare class AiDashboardCard extends AiDashboardCard_base {
|
|
|
14
14
|
editing: boolean;
|
|
15
15
|
first: boolean;
|
|
16
16
|
last: boolean;
|
|
17
|
-
private
|
|
18
|
-
private
|
|
19
|
-
private
|
|
20
|
-
private
|
|
21
|
-
private readingFor?;
|
|
17
|
+
private cardRun;
|
|
18
|
+
private get run();
|
|
19
|
+
private get failed();
|
|
20
|
+
private get loading();
|
|
22
21
|
updated(changes: Map<string, unknown>): void;
|
|
23
|
-
/** Draws the card again from the data
|
|
22
|
+
/** Draws the card again from the data. */
|
|
24
23
|
refresh(): Promise<void>;
|
|
25
24
|
private act;
|
|
26
25
|
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
@@ -7,11 +7,12 @@ import { __decorate, __metadata } from "tslib";
|
|
|
7
7
|
import '@material/web/icon/icon.js';
|
|
8
8
|
import '@things-factory/ai-assistant/dist-client/index.js';
|
|
9
9
|
import { LitElement, css, html, nothing } from 'lit';
|
|
10
|
-
import { customElement, property
|
|
10
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
11
|
+
import gql from 'graphql-tag';
|
|
12
|
+
import { QueryController } from '@operato/graphql';
|
|
11
13
|
import { i18next, localize } from '@operato/i18n';
|
|
12
14
|
import '@operato/popup/ox-popup-menu.js';
|
|
13
15
|
import { OxPopupMenu } from '@operato/popup/ox-popup-menu.js';
|
|
14
|
-
import { cardApi } from '../utils/card-api.js';
|
|
15
16
|
import { drawsNothing, issueLine, ownershipLine, partialLine, readLine, viewIcon } from '../utils/card-words.js';
|
|
16
17
|
const t = (key, options = {}) => String(i18next.t(key, options));
|
|
17
18
|
let AiDashboardCard = class AiDashboardCard extends localize(i18next)(LitElement) {
|
|
@@ -23,7 +24,12 @@ let AiDashboardCard = class AiDashboardCard extends localize(i18next)(LitElement
|
|
|
23
24
|
this.editing = false;
|
|
24
25
|
this.first = false;
|
|
25
26
|
this.last = false;
|
|
26
|
-
|
|
27
|
+
/* The card drawn from the data - the server runs its definition as the viewer (ADR-0190). */
|
|
28
|
+
this.cardRun = new QueryController(this, gql `
|
|
29
|
+
query ($id: String!) {
|
|
30
|
+
dashboardCardRun(id: $id)
|
|
31
|
+
}
|
|
32
|
+
`, { variables: () => (this.card ? { id: this.card.id } : undefined) });
|
|
27
33
|
}
|
|
28
34
|
static { this.styles = css `
|
|
29
35
|
:host {
|
|
@@ -274,35 +280,25 @@ let AiDashboardCard = class AiDashboardCard extends localize(i18next)(LitElement
|
|
|
274
280
|
font-variant-numeric: tabular-nums;
|
|
275
281
|
}
|
|
276
282
|
`; }
|
|
283
|
+
get run() {
|
|
284
|
+
return this.cardRun.data?.dashboardCardRun;
|
|
285
|
+
}
|
|
286
|
+
get failed() {
|
|
287
|
+
const error = this.cardRun.error;
|
|
288
|
+
return error ? (error.message ?? String(error)) : undefined;
|
|
289
|
+
}
|
|
290
|
+
get loading() {
|
|
291
|
+
return this.cardRun.loading;
|
|
292
|
+
}
|
|
277
293
|
updated(changes) {
|
|
278
|
-
/* A new card
|
|
279
|
-
const
|
|
280
|
-
if (
|
|
294
|
+
/* A new version of the same card is read again; a new card is read by its own variables. */
|
|
295
|
+
const old = changes.get('card');
|
|
296
|
+
if (old && this.card && old.id === this.card.id && old.version !== this.card.version)
|
|
281
297
|
this.refresh();
|
|
282
298
|
}
|
|
283
|
-
/** Draws the card again from the data
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
return;
|
|
287
|
-
const key = `${this.card.id}@${this.card.version}`;
|
|
288
|
-
this.readingFor = key;
|
|
289
|
-
this.loading = true;
|
|
290
|
-
this.failed = undefined;
|
|
291
|
-
try {
|
|
292
|
-
const run = await cardApi.run(this.card.id);
|
|
293
|
-
if (this.readingFor !== key)
|
|
294
|
-
return;
|
|
295
|
-
this.run = run;
|
|
296
|
-
this.readAt = new Date();
|
|
297
|
-
}
|
|
298
|
-
catch (error) {
|
|
299
|
-
if (this.readingFor === key)
|
|
300
|
-
this.failed = error?.message ?? String(error);
|
|
301
|
-
}
|
|
302
|
-
finally {
|
|
303
|
-
if (this.readingFor === key)
|
|
304
|
-
this.loading = false;
|
|
305
|
-
}
|
|
299
|
+
/** Draws the card again from the data. */
|
|
300
|
+
refresh() {
|
|
301
|
+
return this.cardRun.refetch();
|
|
306
302
|
}
|
|
307
303
|
act(action) {
|
|
308
304
|
if (action === 'refresh')
|
|
@@ -377,7 +373,7 @@ let AiDashboardCard = class AiDashboardCard extends localize(i18next)(LitElement
|
|
|
377
373
|
renderFooter() {
|
|
378
374
|
const partial = partialLine(this.run, t);
|
|
379
375
|
return html `<footer>
|
|
380
|
-
<span>${readLine(this.run, this.
|
|
376
|
+
<span>${readLine(this.run, this.cardRun.answeredAt ?? new Date(), t, i18next.language)}</span>
|
|
381
377
|
${partial ? html `<span class="partial"><md-icon>warning</md-icon>${partial}</span>` : nothing}
|
|
382
378
|
</footer>`;
|
|
383
379
|
}
|
|
@@ -417,22 +413,6 @@ __decorate([
|
|
|
417
413
|
property({ type: Boolean }),
|
|
418
414
|
__metadata("design:type", Object)
|
|
419
415
|
], AiDashboardCard.prototype, "last", void 0);
|
|
420
|
-
__decorate([
|
|
421
|
-
state(),
|
|
422
|
-
__metadata("design:type", Object)
|
|
423
|
-
], AiDashboardCard.prototype, "run", void 0);
|
|
424
|
-
__decorate([
|
|
425
|
-
state(),
|
|
426
|
-
__metadata("design:type", String)
|
|
427
|
-
], AiDashboardCard.prototype, "failed", void 0);
|
|
428
|
-
__decorate([
|
|
429
|
-
state(),
|
|
430
|
-
__metadata("design:type", Object)
|
|
431
|
-
], AiDashboardCard.prototype, "loading", void 0);
|
|
432
|
-
__decorate([
|
|
433
|
-
state(),
|
|
434
|
-
__metadata("design:type", Date)
|
|
435
|
-
], AiDashboardCard.prototype, "readAt", void 0);
|
|
436
416
|
AiDashboardCard = __decorate([
|
|
437
417
|
customElement('ai-dashboard-card')
|
|
438
418
|
], AiDashboardCard);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard-card.js","sourceRoot":"","sources":["../../client/components/dashboard-card.ts"],"names":[],"mappings":";AAAA;;;;GAIG;AACH,OAAO,4BAA4B,CAAA;AACnC,OAAO,mDAAmD,CAAA;AAE1D,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,iCAAiC,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,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AC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,0BAA0B,CAAC;QAC3K,MAAM,CAAC,SAAS,EAAE,gBAAgB,EAAE,2BAA2B,CAAC;WAC7D,CAAA;IACT,CAAC;;AAhI+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;6CAAgB;AAEnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAAU;AACT;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAW;AACM;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;gDAAgB;AAC9B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;8CAAc;AACb;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;6CAAa;AAExB;IAAhB,KAAK,EAAE;;4CAAsB;AACb;IAAhB,KAAK,EAAE;;+CAAwB;AACf;IAAhB,KAAK,EAAE;;gDAAwB;AACf;IAAhB,KAAK,EAAE;8BAAkB,IAAI;+CAAA;AAtQnB,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA4X3B","sourcesContent":["/*\n * One card on the dashboard - its name and what it reads, the block its definition draws as the viewer, when it was\n * read and how much of its source it was drawn from (ADR-0160 decisions 4-6, 8). Drawing it asks the server to run\n * the definition; no model is asked.\n */\nimport '@material/web/icon/icon.js'\nimport '@things-factory/ai-assistant/dist-client/index.js'\n\nimport { LitElement, css, html, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport '@operato/popup/ox-popup-menu.js'\nimport { OxPopupMenu } from '@operato/popup/ox-popup-menu.js'\n\nimport { cardApi, type CardItem, type CardRun } from '../utils/card-api.js'\nimport { drawsNothing, issueLine, ownershipLine, partialLine, readLine, viewIcon } from '../utils/card-words.js'\n\nconst t = (key: string, options: Record<string, unknown> = {}) => String(i18next.t(key, options))\n\nexport type CardAction = 'refresh' | 'ai' | 'rename' | 'share' | 'versions' | 'copy' | 'unplace' | 'left' | 'right' | 'wider' | 'narrower' | 'taller' | 'shorter'\n\n@customElement('ai-dashboard-card')\nexport class AiDashboardCard extends localize(i18next)(LitElement) {\n static styles = css`\n :host {\n display: block;\n min-width: 0;\n min-height: 0;\n }\n\n article {\n position: relative;\n display: flex;\n flex-direction: column;\n height: 100%;\n box-sizing: border-box;\n border: 1px solid var(--ui-line, var(--md-sys-color-outline-variant));\n border-radius: var(--ui-r, 12px);\n background: var(--ui-panel, var(--md-sys-color-surface-container-lowest));\n overflow: hidden;\n transition:\n box-shadow 0.18s ease,\n border-color 0.18s ease,\n transform 0.18s ease;\n }\n\n article:hover {\n border-color: color-mix(in srgb, var(--ui-accent, var(--md-sys-color-primary)) 35%, var(--ui-line, transparent));\n box-shadow: 0 6px 20px -12px rgb(0 0 0 / 35%);\n }\n\n :host([editing]) article {\n border-style: dashed;\n border-color: var(--ui-accent, var(--md-sys-color-primary));\n }\n\n header {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n padding: 14px 14px 6px 16px;\n }\n\n .kind {\n flex: none;\n display: grid;\n place-items: center;\n width: 30px;\n height: 30px;\n border-radius: 8px;\n background: var(--ui-accent-wash, color-mix(in srgb, var(--md-sys-color-primary) 12%, transparent));\n color: var(--ui-accent, var(--md-sys-color-primary));\n --md-icon-size: 18px;\n }\n\n .titles {\n flex: 1;\n min-width: 0;\n }\n\n h4 {\n margin: 0;\n font-size: var(--ui-t-title, 15px);\n font-weight: 600;\n line-height: 1.3;\n color: var(--ui-ink, var(--md-sys-color-on-surface));\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .sub {\n display: block;\n margin-top: 2px;\n font-size: var(--ui-t-small, 12px);\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .tools {\n flex: none;\n display: flex;\n gap: 2px;\n opacity: 0.55;\n transition: opacity 0.15s ease;\n }\n\n article:hover .tools,\n article:focus-within .tools,\n :host([editing]) .tools {\n opacity: 1;\n }\n\n button.icon {\n display: grid;\n place-items: center;\n width: 30px;\n height: 30px;\n padding: 0;\n border: 0;\n border-radius: 8px;\n background: transparent;\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n cursor: pointer;\n --md-icon-size: 18px;\n }\n\n button.icon:hover,\n button.icon:focus-visible {\n background: var(--ui-hover, var(--md-sys-color-surface-container-high));\n color: var(--ui-ink, var(--md-sys-color-on-surface));\n outline: none;\n }\n\n button.icon[disabled] {\n opacity: 0.35;\n cursor: default;\n }\n\n button.icon.spin md-icon {\n animation: spin 0.9s linear infinite;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .body {\n flex: 1;\n min-height: 0;\n padding: 4px 16px 8px;\n overflow: auto;\n }\n\n .skeleton {\n display: flex;\n flex-direction: column;\n gap: 10px;\n padding-top: 8px;\n }\n\n .skeleton span {\n display: block;\n height: 14px;\n border-radius: 6px;\n background: linear-gradient(90deg, var(--ui-line-soft, #eee) 0%, var(--ui-panel-2, #f6f6f6) 50%, var(--ui-line-soft, #eee) 100%);\n background-size: 200% 100%;\n animation: shimmer 1.4s ease-in-out infinite;\n }\n\n .skeleton span:nth-child(1) {\n width: 40%;\n height: 28px;\n }\n\n .skeleton span:nth-child(2) {\n width: 85%;\n }\n\n .skeleton span:nth-child(3) {\n width: 65%;\n }\n\n @keyframes shimmer {\n from {\n background-position: 200% 0;\n }\n to {\n background-position: -200% 0;\n }\n }\n\n .issue {\n display: flex;\n gap: 10px;\n align-items: flex-start;\n margin-top: 8px;\n padding: 12px;\n border-radius: 8px;\n background: color-mix(in srgb, var(--ui-crit, #c62828) 8%, transparent);\n color: var(--ui-ink, var(--md-sys-color-on-surface));\n font-size: var(--ui-t-body, 13px);\n --md-icon-size: 18px;\n }\n\n .issue md-icon {\n flex: none;\n color: var(--ui-crit, #c62828);\n }\n\n .issue.access {\n background: var(--ui-panel-2, var(--md-sys-color-surface-container));\n }\n\n .issue.access md-icon {\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n }\n\n .nothing {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 6px;\n height: 100%;\n min-height: 120px;\n color: var(--ui-faint, var(--md-sys-color-on-surface-variant));\n font-size: var(--ui-t-body, 13px);\n text-align: center;\n --md-icon-size: 28px;\n }\n\n footer {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 4px 10px;\n padding: 6px 16px 12px;\n font-size: var(--ui-t-micro, 11px);\n color: var(--ui-faint, var(--md-sys-color-on-surface-variant));\n }\n\n footer .partial {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n color: var(--ui-warn, #b26a00);\n --md-icon-size: 14px;\n }\n\n .edit {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n gap: 4px;\n padding: 8px;\n border-top: 1px dashed var(--ui-line, var(--md-sys-color-outline-variant));\n background: var(--ui-panel-2, var(--md-sys-color-surface-container-low));\n }\n\n .edit .size {\n margin: 0 6px;\n font-size: var(--ui-t-small, 12px);\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n font-variant-numeric: tabular-nums;\n }\n `\n\n @property({ attribute: false }) card?: CardItem\n /** The place's size, when it is on the dashboard. */\n @property({ type: Number }) width = 2\n @property({ type: Number }) height = 1\n @property({ type: Boolean, reflect: true }) editing = false\n @property({ type: Boolean }) first = false\n @property({ type: Boolean }) last = false\n\n @state() private run?: CardRun\n @state() private failed?: string\n @state() private loading = false\n @state() private readAt?: Date\n\n private readingFor?: string\n\n updated(changes: Map<string, unknown>) {\n /* A new card, or a new version of it, is read again; nothing else is. */\n const key = this.card ? `${this.card.id}@${this.card.version}` : undefined\n if (changes.has('card') && key && key !== this.readingFor) this.refresh()\n }\n\n /** Draws the card again from the data - the server runs its definition as the viewer. */\n async refresh() {\n if (!this.card) return\n const key = `${this.card.id}@${this.card.version}`\n this.readingFor = key\n this.loading = true\n this.failed = undefined\n try {\n const run = await cardApi.run(this.card.id)\n if (this.readingFor !== key) return\n this.run = run\n this.readAt = new Date()\n } catch (error: any) {\n if (this.readingFor === key) this.failed = error?.message ?? String(error)\n } finally {\n if (this.readingFor === key) this.loading = false\n }\n }\n\n private act(action: CardAction) {\n if (action === 'refresh') return this.refresh()\n this.dispatchEvent(new CustomEvent('card-action', { detail: { action, card: this.card }, bubbles: true, composed: true }))\n }\n\n render() {\n const card = this.card\n if (!card) return nothing\n const owner = card.access === 'owner'\n const source = this.run?.source?.labelKey ? t(this.run.source.labelKey) : ''\n const ownership = ownershipLine(card, t)\n const sub = [card.description || source, ownership].filter(Boolean).join(' · ')\n return html`<article aria-busy=${this.loading ? 'true' : 'false'}>\n <header>\n <span class=\"kind\"><md-icon>${viewIcon(card.definition)}</md-icon></span>\n <div class=\"titles\">\n <h4 title=${card.name}>${card.name}</h4>\n ${sub ? html`<span class=\"sub\" title=${sub}>${sub}</span>` : nothing}\n </div>\n <div class=\"tools\">\n <button class=\"icon ${this.loading ? 'spin' : ''}\" title=${t('ai-dashboard.card.refresh')} aria-label=${t('ai-dashboard.card.refresh')} ?disabled=${this.loading} @click=${() => this.act('refresh')}>\n <md-icon>refresh</md-icon>\n </button>\n ${owner\n ? html`<button class=\"icon\" title=${t('ai-dashboard.card.ai')} aria-label=${t('ai-dashboard.card.ai')} @click=${() => this.act('ai')}><md-icon>auto_awesome</md-icon></button>`\n : nothing}\n <button class=\"icon\" title=${t('ai-dashboard.card.more')} aria-label=${t('ai-dashboard.card.more')} aria-haspopup=\"menu\" @click=${(e: MouseEvent) => this.openMenu(e, owner)}>\n <md-icon>more_vert</md-icon>\n </button>\n </div>\n </header>\n <div class=\"body\">${this.renderBody()}</div>\n ${this.run && !this.run.issue ? this.renderFooter() : nothing}\n ${this.editing ? this.renderEdit() : nothing}\n </article>`\n }\n\n /**\n * The card's actions in the platform's popup menu, placed in the body under the button - a menu drawn inside the card\n * was cut by the card's own edge and the grid's (2026-10-25).\n */\n private openMenu(event: MouseEvent, owner: boolean) {\n event.stopPropagation()\n const at = (event.currentTarget as HTMLElement).getBoundingClientRect()\n const item = (action: CardAction, icon: string, key: string) =>\n html`<ox-popup-menuitem label=${t(key)} @select=${() => this.act(action)}><md-icon slot=\"icon\">${icon}</md-icon></ox-popup-menuitem>`\n OxPopupMenu.open({\n template: html`\n ${owner ? item('ai', 'auto_awesome', 'ai-dashboard.card.ai') : nothing} ${owner ? item('rename', 'edit', 'ai-dashboard.card.rename') : nothing}\n ${owner ? item('share', 'share', 'ai-dashboard.card.share') : nothing} ${owner ? item('versions', 'history', 'ai-dashboard.card.versions') : nothing}\n ${item('copy', 'content_copy', owner ? 'ai-dashboard.card.duplicate' : 'ai-dashboard.card.copy')}\n <div separator></div>\n ${item('unplace', 'remove_circle_outline', 'ai-dashboard.card.unplace')}\n `,\n top: at.bottom,\n right: window.innerWidth - at.right,\n parent: document.body\n })\n }\n\n private renderBody() {\n if (this.failed) return html`<div class=\"issue\"><md-icon>error</md-icon><span>${this.failed}</span></div>`\n if (!this.run) return html`<div class=\"skeleton\" aria-hidden=\"true\"><span></span><span></span><span></span></div>`\n const issue = issueLine(this.run, t)\n if (issue) return html`<div class=\"issue ${issue.access ? 'access' : ''}\"><md-icon>${issue.access ? 'lock' : 'error'}</md-icon><span>${issue.text}</span></div>`\n if (drawsNothing(this.run)) return html`<div class=\"nothing\"><md-icon>inbox</md-icon><span>${t('ai-dashboard.card.nothing')}</span></div>`\n return html`<ox-assistant-workspace-view compact .workspace=${{ name: this.card!.id, title: this.card!.name, blocks: [this.run.block] }}></ox-assistant-workspace-view>`\n }\n\n private renderFooter() {\n const partial = partialLine(this.run!, t)\n return html`<footer>\n <span>${readLine(this.run!, this.readAt ?? new Date(), t, i18next.language)}</span>\n ${partial ? html`<span class=\"partial\"><md-icon>warning</md-icon>${partial}</span>` : nothing}\n </footer>`\n }\n\n private renderEdit() {\n const button = (action: CardAction, icon: string, key: string, disabled = false) =>\n html`<button class=\"icon\" title=${t(key)} aria-label=${t(key)} ?disabled=${disabled} @click=${() => this.act(action)}><md-icon>${icon}</md-icon></button>`\n return html`<div class=\"edit\">\n ${button('left', 'arrow_back', 'ai-dashboard.edit.left', this.first)} ${button('right', 'arrow_forward', 'ai-dashboard.edit.right', this.last)}\n ${button('narrower', 'remove', 'ai-dashboard.edit.narrower', this.width <= 1)}\n <span class=\"size\">${this.width} × ${this.height}</span>\n ${button('wider', 'add', 'ai-dashboard.edit.wider', this.width >= 4)}\n ${button(this.height > 1 ? 'shorter' : 'taller', this.height > 1 ? 'unfold_less' : 'unfold_more', this.height > 1 ? 'ai-dashboard.edit.shorter' : 'ai-dashboard.edit.taller')}\n ${button('unplace', 'delete_outline', 'ai-dashboard.card.unplace')}\n </div>`\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dashboard-card.js","sourceRoot":"","sources":["../../client/components/dashboard-card.ts"],"names":[],"mappings":";AAAA;;;;GAIG;AACH,OAAO,4BAA4B,CAAA;AACnC,OAAO,mDAAmD,CAAA;AAE1D,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eA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AG,CAAC,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,0BAA0B,CAAC;QAC3K,MAAM,CAAC,SAAS,EAAE,gBAAgB,EAAE,2BAA2B,CAAC;WAC7D,CAAA;IACT,CAAC;;AAnI+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;6CAAgB;AAEnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAAU;AACT;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAW;AACM;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;gDAAgB;AAC9B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;8CAAc;AACb;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;6CAAa;AAjQ9B,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA+X3B","sourcesContent":["/*\n * One card on the dashboard - its name and what it reads, the block its definition draws as the viewer, when it was\n * read and how much of its source it was drawn from (ADR-0160 decisions 4-6, 8). Drawing it asks the server to run\n * the definition; no model is asked.\n */\nimport '@material/web/icon/icon.js'\nimport '@things-factory/ai-assistant/dist-client/index.js'\n\nimport { LitElement, css, html, nothing } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport gql from 'graphql-tag'\nimport { QueryController } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport '@operato/popup/ox-popup-menu.js'\nimport { OxPopupMenu } from '@operato/popup/ox-popup-menu.js'\n\nimport { type CardItem, type CardRun } from '../utils/card-api.js'\nimport { drawsNothing, issueLine, ownershipLine, partialLine, readLine, viewIcon } from '../utils/card-words.js'\n\nconst t = (key: string, options: Record<string, unknown> = {}) => String(i18next.t(key, options))\n\nexport type CardAction = 'refresh' | 'ai' | 'rename' | 'share' | 'versions' | 'copy' | 'unplace' | 'left' | 'right' | 'wider' | 'narrower' | 'taller' | 'shorter'\n\n@customElement('ai-dashboard-card')\nexport class AiDashboardCard extends localize(i18next)(LitElement) {\n static styles = css`\n :host {\n display: block;\n min-width: 0;\n min-height: 0;\n }\n\n article {\n position: relative;\n display: flex;\n flex-direction: column;\n height: 100%;\n box-sizing: border-box;\n border: 1px solid var(--ui-line, var(--md-sys-color-outline-variant));\n border-radius: var(--ui-r, 12px);\n background: var(--ui-panel, var(--md-sys-color-surface-container-lowest));\n overflow: hidden;\n transition:\n box-shadow 0.18s ease,\n border-color 0.18s ease,\n transform 0.18s ease;\n }\n\n article:hover {\n border-color: color-mix(in srgb, var(--ui-accent, var(--md-sys-color-primary)) 35%, var(--ui-line, transparent));\n box-shadow: 0 6px 20px -12px rgb(0 0 0 / 35%);\n }\n\n :host([editing]) article {\n border-style: dashed;\n border-color: var(--ui-accent, var(--md-sys-color-primary));\n }\n\n header {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n padding: 14px 14px 6px 16px;\n }\n\n .kind {\n flex: none;\n display: grid;\n place-items: center;\n width: 30px;\n height: 30px;\n border-radius: 8px;\n background: var(--ui-accent-wash, color-mix(in srgb, var(--md-sys-color-primary) 12%, transparent));\n color: var(--ui-accent, var(--md-sys-color-primary));\n --md-icon-size: 18px;\n }\n\n .titles {\n flex: 1;\n min-width: 0;\n }\n\n h4 {\n margin: 0;\n font-size: var(--ui-t-title, 15px);\n font-weight: 600;\n line-height: 1.3;\n color: var(--ui-ink, var(--md-sys-color-on-surface));\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .sub {\n display: block;\n margin-top: 2px;\n font-size: var(--ui-t-small, 12px);\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .tools {\n flex: none;\n display: flex;\n gap: 2px;\n opacity: 0.55;\n transition: opacity 0.15s ease;\n }\n\n article:hover .tools,\n article:focus-within .tools,\n :host([editing]) .tools {\n opacity: 1;\n }\n\n button.icon {\n display: grid;\n place-items: center;\n width: 30px;\n height: 30px;\n padding: 0;\n border: 0;\n border-radius: 8px;\n background: transparent;\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n cursor: pointer;\n --md-icon-size: 18px;\n }\n\n button.icon:hover,\n button.icon:focus-visible {\n background: var(--ui-hover, var(--md-sys-color-surface-container-high));\n color: var(--ui-ink, var(--md-sys-color-on-surface));\n outline: none;\n }\n\n button.icon[disabled] {\n opacity: 0.35;\n cursor: default;\n }\n\n button.icon.spin md-icon {\n animation: spin 0.9s linear infinite;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .body {\n flex: 1;\n min-height: 0;\n padding: 4px 16px 8px;\n overflow: auto;\n }\n\n .skeleton {\n display: flex;\n flex-direction: column;\n gap: 10px;\n padding-top: 8px;\n }\n\n .skeleton span {\n display: block;\n height: 14px;\n border-radius: 6px;\n background: linear-gradient(90deg, var(--ui-line-soft, #eee) 0%, var(--ui-panel-2, #f6f6f6) 50%, var(--ui-line-soft, #eee) 100%);\n background-size: 200% 100%;\n animation: shimmer 1.4s ease-in-out infinite;\n }\n\n .skeleton span:nth-child(1) {\n width: 40%;\n height: 28px;\n }\n\n .skeleton span:nth-child(2) {\n width: 85%;\n }\n\n .skeleton span:nth-child(3) {\n width: 65%;\n }\n\n @keyframes shimmer {\n from {\n background-position: 200% 0;\n }\n to {\n background-position: -200% 0;\n }\n }\n\n .issue {\n display: flex;\n gap: 10px;\n align-items: flex-start;\n margin-top: 8px;\n padding: 12px;\n border-radius: 8px;\n background: color-mix(in srgb, var(--ui-crit, #c62828) 8%, transparent);\n color: var(--ui-ink, var(--md-sys-color-on-surface));\n font-size: var(--ui-t-body, 13px);\n --md-icon-size: 18px;\n }\n\n .issue md-icon {\n flex: none;\n color: var(--ui-crit, #c62828);\n }\n\n .issue.access {\n background: var(--ui-panel-2, var(--md-sys-color-surface-container));\n }\n\n .issue.access md-icon {\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n }\n\n .nothing {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 6px;\n height: 100%;\n min-height: 120px;\n color: var(--ui-faint, var(--md-sys-color-on-surface-variant));\n font-size: var(--ui-t-body, 13px);\n text-align: center;\n --md-icon-size: 28px;\n }\n\n footer {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 4px 10px;\n padding: 6px 16px 12px;\n font-size: var(--ui-t-micro, 11px);\n color: var(--ui-faint, var(--md-sys-color-on-surface-variant));\n }\n\n footer .partial {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n color: var(--ui-warn, #b26a00);\n --md-icon-size: 14px;\n }\n\n .edit {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n gap: 4px;\n padding: 8px;\n border-top: 1px dashed var(--ui-line, var(--md-sys-color-outline-variant));\n background: var(--ui-panel-2, var(--md-sys-color-surface-container-low));\n }\n\n .edit .size {\n margin: 0 6px;\n font-size: var(--ui-t-small, 12px);\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n font-variant-numeric: tabular-nums;\n }\n `\n\n @property({ attribute: false }) card?: CardItem\n /** The place's size, when it is on the dashboard. */\n @property({ type: Number }) width = 2\n @property({ type: Number }) height = 1\n @property({ type: Boolean, reflect: true }) editing = false\n @property({ type: Boolean }) first = false\n @property({ type: Boolean }) last = false\n\n /* The card drawn from the data - the server runs its definition as the viewer (ADR-0190). */\n private cardRun = new QueryController(\n this,\n gql`\n query ($id: String!) {\n dashboardCardRun(id: $id)\n }\n `,\n { variables: () => (this.card ? { id: this.card.id } : undefined) }\n )\n\n private get run(): CardRun | undefined {\n return this.cardRun.data?.dashboardCardRun\n }\n\n private get failed() {\n const error = this.cardRun.error as any\n return error ? (error.message ?? String(error)) : undefined\n }\n\n private get loading() {\n return this.cardRun.loading\n }\n\n updated(changes: Map<string, unknown>) {\n /* A new version of the same card is read again; a new card is read by its own variables. */\n const old = changes.get('card') as CardItem | undefined\n if (old && this.card && old.id === this.card.id && old.version !== this.card.version) this.refresh()\n }\n\n /** Draws the card again from the data. */\n refresh() {\n return this.cardRun.refetch()\n }\n\n private act(action: CardAction) {\n if (action === 'refresh') return this.refresh()\n this.dispatchEvent(new CustomEvent('card-action', { detail: { action, card: this.card }, bubbles: true, composed: true }))\n }\n\n render() {\n const card = this.card\n if (!card) return nothing\n const owner = card.access === 'owner'\n const source = this.run?.source?.labelKey ? t(this.run.source.labelKey) : ''\n const ownership = ownershipLine(card, t)\n const sub = [card.description || source, ownership].filter(Boolean).join(' · ')\n return html`<article aria-busy=${this.loading ? 'true' : 'false'}>\n <header>\n <span class=\"kind\"><md-icon>${viewIcon(card.definition)}</md-icon></span>\n <div class=\"titles\">\n <h4 title=${card.name}>${card.name}</h4>\n ${sub ? html`<span class=\"sub\" title=${sub}>${sub}</span>` : nothing}\n </div>\n <div class=\"tools\">\n <button class=\"icon ${this.loading ? 'spin' : ''}\" title=${t('ai-dashboard.card.refresh')} aria-label=${t('ai-dashboard.card.refresh')} ?disabled=${this.loading} @click=${() => this.act('refresh')}>\n <md-icon>refresh</md-icon>\n </button>\n ${owner\n ? html`<button class=\"icon\" title=${t('ai-dashboard.card.ai')} aria-label=${t('ai-dashboard.card.ai')} @click=${() => this.act('ai')}><md-icon>auto_awesome</md-icon></button>`\n : nothing}\n <button class=\"icon\" title=${t('ai-dashboard.card.more')} aria-label=${t('ai-dashboard.card.more')} aria-haspopup=\"menu\" @click=${(e: MouseEvent) => this.openMenu(e, owner)}>\n <md-icon>more_vert</md-icon>\n </button>\n </div>\n </header>\n <div class=\"body\">${this.renderBody()}</div>\n ${this.run && !this.run.issue ? this.renderFooter() : nothing}\n ${this.editing ? this.renderEdit() : nothing}\n </article>`\n }\n\n /**\n * The card's actions in the platform's popup menu, placed in the body under the button - a menu drawn inside the card\n * was cut by the card's own edge and the grid's (2026-10-25).\n */\n private openMenu(event: MouseEvent, owner: boolean) {\n event.stopPropagation()\n const at = (event.currentTarget as HTMLElement).getBoundingClientRect()\n const item = (action: CardAction, icon: string, key: string) =>\n html`<ox-popup-menuitem label=${t(key)} @select=${() => this.act(action)}><md-icon slot=\"icon\">${icon}</md-icon></ox-popup-menuitem>`\n OxPopupMenu.open({\n template: html`\n ${owner ? item('ai', 'auto_awesome', 'ai-dashboard.card.ai') : nothing} ${owner ? item('rename', 'edit', 'ai-dashboard.card.rename') : nothing}\n ${owner ? item('share', 'share', 'ai-dashboard.card.share') : nothing} ${owner ? item('versions', 'history', 'ai-dashboard.card.versions') : nothing}\n ${item('copy', 'content_copy', owner ? 'ai-dashboard.card.duplicate' : 'ai-dashboard.card.copy')}\n <div separator></div>\n ${item('unplace', 'remove_circle_outline', 'ai-dashboard.card.unplace')}\n `,\n top: at.bottom,\n right: window.innerWidth - at.right,\n parent: document.body\n })\n }\n\n private renderBody() {\n if (this.failed) return html`<div class=\"issue\"><md-icon>error</md-icon><span>${this.failed}</span></div>`\n if (!this.run) return html`<div class=\"skeleton\" aria-hidden=\"true\"><span></span><span></span><span></span></div>`\n const issue = issueLine(this.run, t)\n if (issue) return html`<div class=\"issue ${issue.access ? 'access' : ''}\"><md-icon>${issue.access ? 'lock' : 'error'}</md-icon><span>${issue.text}</span></div>`\n if (drawsNothing(this.run)) return html`<div class=\"nothing\"><md-icon>inbox</md-icon><span>${t('ai-dashboard.card.nothing')}</span></div>`\n return html`<ox-assistant-workspace-view compact .workspace=${{ name: this.card!.id, title: this.card!.name, blocks: [this.run.block] }}></ox-assistant-workspace-view>`\n }\n\n private renderFooter() {\n const partial = partialLine(this.run!, t)\n return html`<footer>\n <span>${readLine(this.run!, this.cardRun.answeredAt ?? new Date(), t, i18next.language)}</span>\n ${partial ? html`<span class=\"partial\"><md-icon>warning</md-icon>${partial}</span>` : nothing}\n </footer>`\n }\n\n private renderEdit() {\n const button = (action: CardAction, icon: string, key: string, disabled = false) =>\n html`<button class=\"icon\" title=${t(key)} aria-label=${t(key)} ?disabled=${disabled} @click=${() => this.act(action)}><md-icon>${icon}</md-icon></button>`\n return html`<div class=\"edit\">\n ${button('left', 'arrow_back', 'ai-dashboard.edit.left', this.first)} ${button('right', 'arrow_forward', 'ai-dashboard.edit.right', this.last)}\n ${button('narrower', 'remove', 'ai-dashboard.edit.narrower', this.width <= 1)}\n <span class=\"size\">${this.width} × ${this.height}</span>\n ${button('wider', 'add', 'ai-dashboard.edit.wider', this.width >= 4)}\n ${button(this.height > 1 ? 'shorter' : 'taller', this.height > 1 ? 'unfold_less' : 'unfold_more', this.height > 1 ? 'ai-dashboard.edit.shorter' : 'ai-dashboard.edit.taller')}\n ${button('unplace', 'delete_outline', 'ai-dashboard.card.unplace')}\n </div>`\n }\n}\n"]}
|
|
@@ -7,11 +7,9 @@ export declare class ProposalPreview extends ProposalPreview_base {
|
|
|
7
7
|
proposal: any;
|
|
8
8
|
sessionId?: string;
|
|
9
9
|
proposalKey?: string;
|
|
10
|
-
private
|
|
11
|
-
private
|
|
12
|
-
private
|
|
13
|
-
updated(): void;
|
|
14
|
-
private read;
|
|
10
|
+
private preview;
|
|
11
|
+
private get run();
|
|
12
|
+
private get failed();
|
|
15
13
|
render(): import("lit-html").TemplateResult<1>;
|
|
16
14
|
}
|
|
17
15
|
export {};
|