@things-factory/gallery 0.0.0-stage → 10.1.226

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/client/bootstrap.ts +16 -0
  2. package/client/components/gallery-forms.ts +188 -0
  3. package/client/components/gallery-uploader.ts +557 -0
  4. package/client/components/gallery-viewer.ts +397 -0
  5. package/client/index.ts +1 -0
  6. package/client/pages/gallery-page.ts +567 -0
  7. package/client/route.ts +8 -0
  8. package/client/tsconfig.json +13 -0
  9. package/client/utils/gallery-api.ts +157 -0
  10. package/client/utils/gallery-badge.ts +44 -0
  11. package/client/utils/gallery-words.ts +22 -0
  12. package/client/utils/photo-prep.ts +93 -0
  13. package/dist-client/bootstrap.d.ts +1 -0
  14. package/dist-client/bootstrap.js +16 -0
  15. package/dist-client/bootstrap.js.map +1 -0
  16. package/dist-client/components/gallery-forms.d.ts +31 -0
  17. package/dist-client/components/gallery-forms.js +223 -0
  18. package/dist-client/components/gallery-forms.js.map +1 -0
  19. package/dist-client/components/gallery-uploader.d.ts +51 -0
  20. package/dist-client/components/gallery-uploader.js +588 -0
  21. package/dist-client/components/gallery-uploader.js.map +1 -0
  22. package/dist-client/components/gallery-viewer.d.ts +30 -0
  23. package/dist-client/components/gallery-viewer.js +416 -0
  24. package/dist-client/components/gallery-viewer.js.map +1 -0
  25. package/dist-client/index.d.ts +1 -0
  26. package/dist-client/index.js +2 -0
  27. package/dist-client/index.js.map +1 -0
  28. package/dist-client/pages/gallery-page.d.ts +55 -0
  29. package/dist-client/pages/gallery-page.js +586 -0
  30. package/dist-client/pages/gallery-page.js.map +1 -0
  31. package/dist-client/route.d.ts +1 -0
  32. package/dist-client/route.js +9 -0
  33. package/dist-client/route.js.map +1 -0
  34. package/dist-client/tsconfig.tsbuildinfo +1 -0
  35. package/dist-client/utils/gallery-api.d.ts +95 -0
  36. package/dist-client/utils/gallery-api.js +46 -0
  37. package/dist-client/utils/gallery-api.js.map +1 -0
  38. package/dist-client/utils/gallery-badge.d.ts +4 -0
  39. package/dist-client/utils/gallery-badge.js +45 -0
  40. package/dist-client/utils/gallery-badge.js.map +1 -0
  41. package/dist-client/utils/gallery-words.d.ts +7 -0
  42. package/dist-client/utils/gallery-words.js +20 -0
  43. package/dist-client/utils/gallery-words.js.map +1 -0
  44. package/dist-client/utils/photo-prep.d.ts +10 -0
  45. package/dist-client/utils/photo-prep.js +102 -0
  46. package/dist-client/utils/photo-prep.js.map +1 -0
  47. package/dist-server/attachment-reader.d.ts +1 -0
  48. package/dist-server/attachment-reader.js +13 -0
  49. package/dist-server/attachment-reader.js.map +1 -0
  50. package/dist-server/index.d.ts +1 -0
  51. package/dist-server/index.js +11 -0
  52. package/dist-server/index.js.map +1 -0
  53. package/dist-server/role-tasks.d.ts +2 -0
  54. package/dist-server/role-tasks.js +15 -0
  55. package/dist-server/role-tasks.js.map +1 -0
  56. package/dist-server/service/gallery/gallery-resolver.d.ts +29 -0
  57. package/dist-server/service/gallery/gallery-resolver.js +602 -0
  58. package/dist-server/service/gallery/gallery-resolver.js.map +1 -0
  59. package/dist-server/service/gallery/gallery-rules.d.ts +88 -0
  60. package/dist-server/service/gallery/gallery-rules.js +181 -0
  61. package/dist-server/service/gallery/gallery-rules.js.map +1 -0
  62. package/dist-server/service/gallery/gallery-service.d.ts +37 -0
  63. package/dist-server/service/gallery/gallery-service.js +234 -0
  64. package/dist-server/service/gallery/gallery-service.js.map +1 -0
  65. package/dist-server/service/gallery/gallery-types.d.ts +62 -0
  66. package/dist-server/service/gallery/gallery-types.js +227 -0
  67. package/dist-server/service/gallery/gallery-types.js.map +1 -0
  68. package/dist-server/service/gallery/gallery.d.ts +83 -0
  69. package/dist-server/service/gallery/gallery.js +330 -0
  70. package/dist-server/service/gallery/gallery.js.map +1 -0
  71. package/dist-server/service/gallery/index.d.ts +4 -0
  72. package/dist-server/service/gallery/index.js +8 -0
  73. package/dist-server/service/gallery/index.js.map +1 -0
  74. package/dist-server/service/index.d.ts +7 -0
  75. package/dist-server/service/index.js +23 -0
  76. package/dist-server/service/index.js.map +1 -0
  77. package/dist-server/tsconfig.tsbuildinfo +1 -0
  78. package/package.json +48 -4
  79. package/server/attachment-reader.ts +14 -0
  80. package/server/index.ts +9 -0
  81. package/server/role-tasks.ts +14 -0
  82. package/server/service/gallery/gallery-resolver.ts +541 -0
  83. package/server/service/gallery/gallery-rules.ts +187 -0
  84. package/server/service/gallery/gallery-service.ts +254 -0
  85. package/server/service/gallery/gallery-types.ts +151 -0
  86. package/server/service/gallery/gallery.ts +266 -0
  87. package/server/service/gallery/index.ts +5 -0
  88. package/server/service/index.ts +19 -0
  89. package/server/tsconfig.json +11 -0
  90. package/test/gallery-persistence.test.ts +372 -0
  91. package/test/gallery-rules.test.ts +140 -0
  92. package/test/open-doors.test.ts +62 -0
  93. package/test/photo-prep.test.ts +61 -0
  94. package/test/translations.test.ts +68 -0
  95. package/things-factory.config.js +8 -0
  96. package/translations/en.json +91 -0
  97. package/translations/es.json +91 -0
  98. package/translations/ja.json +91 -0
  99. package/translations/ko.json +91 -0
  100. package/translations/ms.json +91 -0
  101. package/translations/zh.json +91 -0
  102. package/README.md +0 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gallery-uploader.js","sourceRoot":"","sources":["../../client/components/gallery-uploader.ts"],"names":[],"mappings":";AAAA;;;;GAIG;AACH,OAAO,uCAAuC,CAAA;AAC9C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,4BAA4B,CAAA;AACnC,OAAO,iCAAiC,CAAA;AACxC,OAAO,oCAAoC,CAAA;AAE3C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,M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R-0165 decision 3) - and changing one's own post. Photos are all it needs; the caption, the tags\n * and the event are there to add. When the photos were taken is read from the first one, and the events near that day\n * are offered first - one press puts the post on one.\n */\nimport '@material/web/button/filled-button.js'\nimport '@material/web/button/text-button.js'\nimport '@material/web/icon/icon.js'\nimport '@operato/input/ox-input-file.js'\nimport '@operato/popup/ox-popup-actions.js'\n\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { notify } from '@operato/layout'\nimport { CommonPopupStyles, PopupBodyStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n\nimport {\n galleryApi,\n galleryChanged,\n type EventChoice,\n type Photo,\n type Post,\n type Space\n} from '../utils/gallery-api.js'\nimport { day, reasonOf, t } from '../utils/gallery-words.js'\nimport { shrunk, takenAtOf } from '../utils/photo-prep.js'\n\nconst MAX_PHOTOS = 20\nconst MAX_CAPTION = 500\nconst MAX_TAGS = 10\n/* The events shown before 「more」 - the near ones are among them. */\nconst FIRST_CHOICES = 4\n\ntype Added = { file: File; url: string }\n\n/** yyyy-mm-dd of a date in the reader's own time. */\nconst dateText = (value: Date) =>\n `${value.getFullYear()}-${String(value.getMonth() + 1).padStart(2, '0')}-${String(value.getDate()).padStart(2, '0')}`\n\n@customElement('gallery-uploader')\nexport class GalleryUploader extends localize(i18next)(LitElement) {\n static styles = [\n CommonPopupStyles,\n PopupBodyStyles,\n css`\n :host {\n height: 100%;\n }\n .body {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-large, 12px);\n }\n h4 {\n margin: 0 0 var(--spacing-small, 4px);\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 }\n .photos {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));\n gap: var(--spacing-small, 4px);\n }\n .photo {\n position: relative;\n aspect-ratio: 1;\n border-radius: var(--border-radius, 4px);\n overflow: hidden;\n background: var(--md-sys-color-surface-container-high);\n }\n .photo img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n display: block;\n }\n .photo button {\n position: absolute;\n top: 2px;\n inset-inline-end: 2px;\n display: inline-flex;\n padding: 2px;\n border: 0;\n border-radius: 50%;\n background: rgb(0 0 0 / 55%);\n color: #fff;\n cursor: pointer;\n }\n .photo button md-icon {\n --md-icon-size: 16px;\n }\n .add {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 2px;\n aspect-ratio: 1;\n border: 1px dashed var(--ui-line, var(--md-sys-color-outline));\n border-radius: var(--border-radius, 4px);\n background: none;\n color: var(--md-sys-color-primary);\n font: inherit;\n font-size: var(--ui-t-small, 12px);\n cursor: pointer;\n }\n .add[disabled] {\n opacity: 0.4;\n cursor: default;\n }\n ox-input-file {\n display: contents;\n }\n textarea,\n input {\n box-sizing: border-box;\n width: 100%;\n font: inherit;\n font-size: var(--ui-t-body, 14px);\n padding: var(--spacing-small, 4px) var(--spacing-medium, 8px);\n border: 1px solid var(--ui-line, var(--md-sys-color-outline-variant));\n border-radius: var(--border-radius, 4px);\n background: var(--md-sys-color-surface);\n color: var(--md-sys-color-on-surface);\n }\n textarea {\n min-height: 64px;\n resize: vertical;\n }\n input[type='date'] {\n width: auto;\n }\n .count {\n text-align: end;\n font-size: var(--ui-t-small, 12px);\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n }\n .chips {\n display: flex;\n flex-wrap: wrap;\n gap: var(--spacing-small, 4px);\n align-items: center;\n }\n .chip {\n display: inline-flex;\n align-items: center;\n gap: 2px;\n padding: 2px var(--spacing-medium, 8px);\n border: 1px solid var(--ui-line-soft, var(--md-sys-color-outline-variant));\n border-radius: 999px;\n background: none;\n color: var(--md-sys-color-on-surface);\n font: inherit;\n font-size: var(--ui-t-small, 12px);\n line-height: 1.6;\n cursor: pointer;\n }\n .chip[aria-pressed='true'] {\n border-color: var(--md-sys-color-primary);\n background: var(--md-sys-color-primary-container);\n color: var(--md-sys-color-on-primary-container);\n }\n .chip md-icon {\n --md-icon-size: 14px;\n }\n .chip .near {\n color: var(--md-sys-color-primary);\n }\n .tag-input {\n flex: 1;\n min-width: 120px;\n width: auto;\n border: 0;\n padding: 2px 0;\n background: none;\n }\n .tag-input:focus {\n outline: none;\n }\n .tags {\n padding: var(--spacing-small, 4px) var(--spacing-medium, 8px);\n border: 1px solid var(--ui-line, var(--md-sys-color-outline-variant));\n border-radius: var(--border-radius, 4px);\n }\n .suggest {\n margin-top: var(--spacing-small, 4px);\n }\n .suggest .chip {\n border-style: dashed;\n }\n .muted {\n font-size: var(--ui-t-small, 12px);\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n }\n .row {\n display: flex;\n flex-wrap: wrap;\n gap: var(--spacing-large, 12px);\n align-items: flex-end;\n }\n `\n ]\n\n /** The post being changed - nothing when posting a new one. */\n @property({ attribute: false }) post?: Post\n /** The photos the page picked before the window opened. */\n @property({ attribute: false }) files: File[] = []\n /** Where a new post goes - the screen it was opened from. */\n @property() space: Space = 'COMPANY'\n @property() eventId?: string | null\n\n @state() private added: Added[] = []\n @state() private kept: Photo[] = []\n @state() private caption = ''\n @state() private tags: string[] = []\n @state() private tagText = ''\n @state() private suggestions: { tag: string; count: number }[] = []\n @state() private chosenSpace: Space = 'COMPANY'\n @state() private chosenEvent: string | null = null\n @state() private takenOn = dateText(new Date())\n @state() private choices: EventChoice[] = []\n @state() private allChoices = false\n @state() private progress?: number\n @state() private busy = false\n\n @query('#pick') private picker!: any\n @query('#shoot') private camera!: any\n\n private suggestTimer?: ReturnType<typeof setTimeout>\n\n render() {\n const total = this.kept.length + this.added.length\n const full = total >= MAX_PHOTOS\n const company = this.chosenSpace === 'COMPANY'\n const shown = this.allChoices ? this.choices : this.choices.slice(0, FIRST_CHOICES)\n const chosen = this.choices.find(one => one.id === this.chosenEvent)\n return html`<div class=\"body\">\n <section>\n <div class=\"photos\">\n ${this.kept.map(\n one =>\n html`<div class=\"photo\">\n <img src=${one.thumbnail || one.fullpath} alt=\"\" />\n <button\n aria-label=${t('gallery.button.remove-photo')}\n @click=${() => (this.kept = this.kept.filter(other => other !== one))}\n >\n <md-icon>close</md-icon>\n </button>\n </div>`\n )}\n ${this.added.map(\n one =>\n html`<div class=\"photo\">\n <img src=${one.url} alt=\"\" />\n <button aria-label=${t('gallery.button.remove-photo')} @click=${() => this.drop(one)}>\n <md-icon>close</md-icon>\n </button>\n </div>`\n )}\n <button class=\"add\" ?disabled=${full || this.busy} @click=${() => this.picker?.pick()}>\n <md-icon>add_photo_alternate</md-icon>${t('gallery.button.add-photos')}\n </button>\n ${\n isMobileDevice()\n ? html`<button class=\"add\" ?disabled=${full || this.busy} @click=${() => this.camera?.pick()}>\n <md-icon>photo_camera</md-icon>${t('gallery.button.shoot-more')}\n </button>`\n : nothing\n }\n </div>\n <ox-input-file\n id=\"pick\"\n quiet\n outside-trigger\n hide-filelist\n multiple\n accept=\"image/*\"\n .progress=${this.progress}\n @change=${(e: CustomEvent) => this.take(e)}\n ></ox-input-file>\n <ox-input-file\n id=\"shoot\"\n quiet\n outside-trigger\n hide-filelist\n accept=\"image/*\"\n capture=\"environment\"\n @change=${(e: CustomEvent) => this.take(e)}\n ></ox-input-file>\n ${full ? html`<div class=\"muted\">${t('gallery.text.photos-full', { count: MAX_PHOTOS })}</div>` : nothing}\n </section>\n\n <section>\n <textarea\n maxlength=${MAX_CAPTION}\n placeholder=${t('gallery.text.caption-placeholder')}\n .value=${this.caption}\n @input=${(e: any) => (this.caption = e.target.value)}\n ></textarea>\n ${this.caption.length > MAX_CAPTION * 0.8 ? html`<div class=\"count\">${this.caption.length} / ${MAX_CAPTION}</div>` : nothing}\n </section>\n\n <section>\n <h4>${t('gallery.field.tags')}</h4>\n <div class=\"chips tags\">\n ${this.tags.map(tag => html`<span class=\"chip\">#${tag}<md-icon role=\"button\" aria-label=${t('gallery.button.remove-tag')} @click=${() => (this.tags = this.tags.filter(one => one !== tag))}>close</md-icon></span>`)}\n ${\n this.tags.length < MAX_TAGS\n ? html`<input\n class=\"tag-input\"\n .value=${this.tagText}\n placeholder=${this.tags.length ? '' : t('gallery.text.tag-placeholder')}\n @input=${(e: any) => this.typeTag(e.target.value)}\n @keydown=${(e: KeyboardEvent) => this.tagKey(e)}\n @blur=${() => this.addTag(this.tagText)}\n />`\n : nothing\n }\n </div>\n ${\n this.suggestions.length\n ? html`<div class=\"chips suggest\">\n ${this.suggestions.filter(one => !this.tags.some(tag => tag.toLowerCase() === one.tag.toLowerCase())).map(one => html`<button class=\"chip\" @mousedown=${(e: Event) => e.preventDefault()} @click=${() => this.addTag(one.tag)}>#${one.tag}</button>`)}\n </div>`\n : nothing\n }\n </section>\n\n <section class=\"row\">\n <div>\n <h4>${t('gallery.field.space')}</h4>\n <div class=\"chips\">\n ${(['COMPANY', 'PERSONAL'] as Space[]).map(\n space =>\n html`<button\n class=\"chip\"\n aria-pressed=${String(this.chosenSpace === space)}\n @click=${() => this.chooseSpace(space)}\n >\n ${t(`gallery.space.${space}`)}\n </button>`\n )}\n </div>\n </div>\n <div>\n <h4>${t('gallery.field.taken-on')}</h4>\n <input type=\"date\" .value=${this.takenOn} @change=${(e: any) => this.changeDay(e.target.value)} />\n </div>\n </section>\n\n ${\n company\n ? html`<section>\n <h4>${t('gallery.field.event')}</h4>\n <div class=\"chips\">\n <button\n class=\"chip\"\n aria-pressed=${String(!this.chosenEvent)}\n @click=${() => (this.chosenEvent = null)}\n >\n ${t('gallery.text.no-event')}\n </button>\n ${chosen && !shown.includes(chosen) ? this.choiceChip(chosen) : nothing}\n ${shown.map(one => this.choiceChip(one))}\n ${\n this.choices.length > FIRST_CHOICES && !this.allChoices\n ? html`<button class=\"chip\" @click=${() => (this.allChoices = true)}>\n ${t('gallery.button.more-events', { count: this.choices.length - FIRST_CHOICES })}\n </button>`\n : nothing\n }\n </div>\n </section>`\n : html`<div class=\"muted\">${t('gallery.text.personal-note')}</div>`\n }\n </div>\n <ox-popup-actions>\n <md-text-button slot=\"cancel\" ?disabled=${this.busy} @click=${() => this.close()}\n >${t('gallery.button.cancel')}</md-text-button\n >\n <md-filled-button slot=\"confirm\" ?disabled=${this.busy || total < 1} @click=${() => this.save()}\n >${this.post ? t('gallery.button.save') : t('gallery.button.post-count', { count: total })}</md-filled-button\n >\n </ox-popup-actions>`\n }\n\n private choiceChip(one: EventChoice) {\n return html`<button\n class=\"chip\"\n aria-pressed=${String(this.chosenEvent === one.id)}\n @click=${() => (this.chosenEvent = one.id)}\n >\n ${one.near ? html`<md-icon class=\"near\">event_available</md-icon>` : nothing}${one.name}<span class=\"muted\"\n >· ${day(one.startAt)}</span\n >\n </button>`\n }\n\n async firstUpdated() {\n const post = this.post\n if (post) {\n this.kept = [...post.photos]\n this.caption = post.caption ?? ''\n this.tags = [...(post.tags ?? [])]\n this.chosenSpace = post.space\n this.chosenEvent = post.event?.id ?? null\n this.takenOn = dateText(new Date(post.takenAt))\n } else {\n this.chosenSpace = this.eventId ? 'COMPANY' : this.space\n this.chosenEvent = this.eventId ?? null\n }\n await this.add(this.files ?? [])\n await this.loadChoices()\n }\n\n disconnectedCallback() {\n for (const one of this.added) URL.revokeObjectURL(one.url)\n clearTimeout(this.suggestTimer)\n super.disconnectedCallback()\n }\n\n private async take(e: CustomEvent) {\n const picked = [...((e.detail as File[]) ?? [])]\n /* The picker's own reset says `change` again, with nothing - that one is let go. */\n if (!picked.length) return\n ;(e.target as any).reset?.()\n const before = this.kept.length + this.added.length\n await this.add(picked)\n /* The first photo says the day - the events near it come first. */\n if (!before && !this.post) await this.loadChoices()\n }\n\n private async add(files: File[]) {\n const room = MAX_PHOTOS - this.kept.length - this.added.length\n const photos = files\n .filter(file => /^image\\//i.test(file.type) || /\\.(jpe?g|png|gif|webp|heic|heif)$/i.test(file.name))\n .slice(0, Math.max(0, room))\n if (photos.length < files.length)\n notify({ level: 'warn', message: t('gallery.text.photos-skipped', { count: files.length - photos.length }) })\n if (!photos.length) return\n const first = !this.kept.length && !this.added.length && !this.post\n this.added = [...this.added, ...photos.map(file => ({ file, url: URL.createObjectURL(file) }))]\n if (first) {\n const takenAt = await takenAtOf(photos[0])\n if (takenAt) this.takenOn = dateText(takenAt)\n }\n }\n\n private drop(one: Added) {\n URL.revokeObjectURL(one.url)\n this.added = this.added.filter(other => other !== one)\n }\n\n private takenAt(): string {\n const [y, m, d] = this.takenOn.split('-').map(Number)\n const now = new Date()\n /* A day chosen without its hour keeps the hour it was posted - today's photo is not dated midnight. */\n const at = y ? new Date(y, m - 1, d, now.getHours(), now.getMinutes()) : now\n return at.toISOString()\n }\n\n private async loadChoices() {\n try {\n /* Offered, not chosen: the events near that day come first, and one press puts the post on one. */\n this.choices = await galleryApi.eventChoices(this.takenAt())\n } catch {\n this.choices = []\n }\n }\n\n private async changeDay(value: string) {\n if (!value) return\n this.takenOn = value\n await this.loadChoices()\n }\n\n private chooseSpace(space: Space) {\n this.chosenSpace = space\n if (space === 'PERSONAL') this.chosenEvent = null\n }\n\n private typeTag(value: string) {\n if (/[,\\s]$/.test(value) && value.trim()) {\n this.addTag(value)\n return\n }\n this.tagText = value\n clearTimeout(this.suggestTimer)\n this.suggestTimer = setTimeout(async () => {\n try {\n this.suggestions = await galleryApi.tags(this.tagText)\n } catch {\n this.suggestions = []\n }\n }, 200)\n }\n\n private tagKey(e: KeyboardEvent) {\n if (e.isComposing) return\n if (e.key === 'Enter') {\n e.preventDefault()\n this.addTag(this.tagText)\n } else if (e.key === 'Backspace' && !this.tagText && this.tags.length) {\n this.tags = this.tags.slice(0, -1)\n }\n }\n\n private addTag(raw: string) {\n const tag = raw.replace(/[,]/g, ' ').trim().replace(/^#+/, '').replace(/\\s+/g, ' ').trim()\n this.tagText = ''\n if (!tag || this.tags.length >= MAX_TAGS || this.tags.some(one => one.toLowerCase() === tag.toLowerCase())) return\n this.tags = [...this.tags, tag.slice(0, 30)]\n }\n\n private async save() {\n this.addTag(this.tagText)\n this.busy = true\n try {\n const files = await Promise.all(this.added.map(one => shrunk(one.file)))\n const input = {\n space: this.chosenSpace,\n caption: this.caption.trim(),\n takenAt: this.takenAt(),\n tags: this.tags,\n eventId: this.chosenSpace === 'COMPANY' ? this.chosenEvent : null\n }\n const uploading = (fraction: number) => (this.progress = fraction)\n const post = this.post\n ? await galleryApi.update(\n this.post.id,\n input,\n files,\n this.post.photos.filter(one => !this.kept.includes(one)).map(one => one.id),\n uploading\n )\n : await galleryApi.create(input, files, uploading)\n notify({ message: this.post ? t('gallery.text.saved') : t('gallery.text.posted') })\n galleryChanged()\n this.dispatchEvent(new CustomEvent('gallery-posted', { detail: post, bubbles: true, composed: true }))\n this.close()\n } catch (error) {\n notify({ level: 'error', message: reasonOf(error) })\n } finally {\n this.progress = undefined\n this.busy = false\n }\n }\n\n private close() {\n this.dispatchEvent(new CustomEvent('done', { bubbles: true, composed: true }))\n }\n}\n"]}
@@ -0,0 +1,30 @@
1
+ import '@material/web/button/filled-button.js';
2
+ import '@material/web/button/text-button.js';
3
+ import '@material/web/icon/icon.js';
4
+ import '@operato/popup/ox-popup-actions.js';
5
+ import { LitElement, nothing } from 'lit';
6
+ import { type Post } from '../utils/gallery-api.js';
7
+ declare const GalleryViewer_base: (new (...args: any[]) => LitElement) & typeof LitElement;
8
+ export declare class GalleryViewer extends GalleryViewer_base {
9
+ static styles: import("lit").CSSResult[];
10
+ post: Post;
11
+ private index;
12
+ private likers?;
13
+ private hiding;
14
+ private reason;
15
+ private burst;
16
+ private busy;
17
+ render(): import("lit-html").TemplateResult<1> | typeof nothing;
18
+ private replace;
19
+ /** Likes it, or takes the like back. A double press on the photo only likes - it never takes one back. */
20
+ private like;
21
+ private showLikers;
22
+ private edit;
23
+ private deletePost;
24
+ private hide;
25
+ private unhide;
26
+ private go;
27
+ /** The next step - a page to go to, or the post to change - goes as the popup's result: the page takes it once the popup is gone. */
28
+ private close;
29
+ }
30
+ export {};
@@ -0,0 +1,416 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ /*
3
+ * One post seen large (ADR-0165 decisions 4-6): its photos one by one, the like (the heart, or a double press on the
4
+ * photo), who posted it and when, its event and tags - each opens the gallery narrowed to it. Its owner changes or
5
+ * deletes it here; a moderator hides it here, with the reason, or shows it again. Where to go next is the popup's result
6
+ * - a popup closes by going back in the history, so a page opened before it is gone would be gone with it.
7
+ */
8
+ import '@material/web/button/filled-button.js';
9
+ import '@material/web/button/text-button.js';
10
+ import '@material/web/icon/icon.js';
11
+ import '@operato/popup/ox-popup-actions.js';
12
+ import { css, html, LitElement, nothing } from 'lit';
13
+ import { customElement, property, state } from 'lit/decorators.js';
14
+ import { i18next, localize } from '@operato/i18n';
15
+ import { notify } from '@operato/layout';
16
+ import { OxPrompt } from '@operato/popup/ox-prompt.js';
17
+ import { CommonPopupStyles, PopupBodyStyles } from '@operato/styles';
18
+ import { galleryApi, galleryChanged } from '../utils/gallery-api.js';
19
+ import { day, days, reasonOf, t } from '../utils/gallery-words.js';
20
+ let GalleryViewer = class GalleryViewer extends localize(i18next)(LitElement) {
21
+ constructor() {
22
+ super(...arguments);
23
+ this.index = 0;
24
+ this.hiding = false;
25
+ this.reason = '';
26
+ this.burst = 0;
27
+ this.busy = false;
28
+ }
29
+ static { this.styles = [
30
+ CommonPopupStyles,
31
+ PopupBodyStyles,
32
+ css `
33
+ :host {
34
+ height: 100%;
35
+ }
36
+ .body {
37
+ display: flex;
38
+ flex-direction: column;
39
+ gap: var(--spacing-medium, 8px);
40
+ }
41
+ .stage {
42
+ position: relative;
43
+ display: flex;
44
+ align-items: center;
45
+ justify-content: center;
46
+ min-height: 240px;
47
+ max-height: 62vh;
48
+ background: var(--md-sys-color-surface-container-highest);
49
+ border-radius: var(--border-radius, 4px);
50
+ overflow: hidden;
51
+ user-select: none;
52
+ }
53
+ .stage img {
54
+ max-width: 100%;
55
+ max-height: 62vh;
56
+ object-fit: contain;
57
+ display: block;
58
+ }
59
+ .stage .turn {
60
+ position: absolute;
61
+ top: 50%;
62
+ transform: translateY(-50%);
63
+ display: inline-flex;
64
+ padding: 4px;
65
+ border: 0;
66
+ border-radius: 50%;
67
+ background: rgb(0 0 0 / 45%);
68
+ color: #fff;
69
+ cursor: pointer;
70
+ }
71
+ .stage .previous {
72
+ inset-inline-start: var(--spacing-small, 4px);
73
+ }
74
+ .stage .next {
75
+ inset-inline-end: var(--spacing-small, 4px);
76
+ }
77
+ .stage .index {
78
+ position: absolute;
79
+ bottom: var(--spacing-small, 4px);
80
+ inset-inline-end: var(--spacing-medium, 8px);
81
+ padding: 0 6px;
82
+ border-radius: 999px;
83
+ background: rgb(0 0 0 / 45%);
84
+ color: #fff;
85
+ font-size: var(--ui-t-small, 12px);
86
+ }
87
+ .burst {
88
+ position: absolute;
89
+ --md-icon-size: 72px;
90
+ color: #fff;
91
+ opacity: 0.9;
92
+ animation: burst 600ms ease-out forwards;
93
+ pointer-events: none;
94
+ }
95
+ @keyframes burst {
96
+ from {
97
+ transform: scale(0.6);
98
+ opacity: 0.9;
99
+ }
100
+ to {
101
+ transform: scale(1.3);
102
+ opacity: 0;
103
+ }
104
+ }
105
+ .line {
106
+ display: flex;
107
+ flex-wrap: wrap;
108
+ align-items: center;
109
+ gap: var(--spacing-small, 4px) var(--spacing-medium, 8px);
110
+ font-size: var(--ui-t-small, 12px);
111
+ color: var(--ui-muted, var(--md-sys-color-on-surface-variant));
112
+ }
113
+ .heart {
114
+ display: inline-flex;
115
+ align-items: center;
116
+ gap: 2px;
117
+ padding: 0;
118
+ border: 0;
119
+ background: none;
120
+ color: var(--md-sys-color-on-surface);
121
+ font: inherit;
122
+ font-size: var(--ui-t-body, 14px);
123
+ cursor: pointer;
124
+ }
125
+ /* The app's icons are drawn filled; an empty heart says not liked yet. */
126
+ .heart md-icon {
127
+ --md-icon-size: 22px;
128
+ font-variation-settings: 'FILL' 0;
129
+ }
130
+ .heart[aria-pressed='true'] md-icon {
131
+ color: var(--md-sys-color-error);
132
+ font-variation-settings: 'FILL' 1;
133
+ }
134
+ .link {
135
+ display: inline-flex;
136
+ align-items: center;
137
+ gap: 2px;
138
+ padding: 0;
139
+ border: 0;
140
+ background: none;
141
+ color: var(--md-sys-color-primary);
142
+ font: inherit;
143
+ cursor: pointer;
144
+ }
145
+ .link:hover {
146
+ text-decoration: underline;
147
+ }
148
+ .link md-icon {
149
+ --md-icon-size: 14px;
150
+ }
151
+ .caption {
152
+ margin: 0;
153
+ font-size: var(--ui-t-body, 14px);
154
+ line-height: 1.6;
155
+ white-space: pre-wrap;
156
+ overflow-wrap: anywhere;
157
+ color: var(--md-sys-color-on-surface);
158
+ }
159
+ .hidden {
160
+ padding: var(--spacing-small, 4px) var(--spacing-medium, 8px);
161
+ border-radius: var(--border-radius, 4px);
162
+ background: var(--md-sys-color-error-container);
163
+ color: var(--md-sys-color-on-error-container);
164
+ font-size: var(--ui-t-small, 12px);
165
+ }
166
+ .likers {
167
+ font-size: var(--ui-t-small, 12px);
168
+ color: var(--ui-muted, var(--md-sys-color-on-surface-variant));
169
+ }
170
+ textarea {
171
+ box-sizing: border-box;
172
+ width: 100%;
173
+ min-height: 56px;
174
+ font: inherit;
175
+ padding: var(--spacing-small, 4px) var(--spacing-medium, 8px);
176
+ border: 1px solid var(--ui-line, var(--md-sys-color-outline-variant));
177
+ border-radius: var(--border-radius, 4px);
178
+ background: var(--md-sys-color-surface);
179
+ color: var(--md-sys-color-on-surface);
180
+ }
181
+ .spacer {
182
+ margin-inline-end: auto;
183
+ }
184
+ `
185
+ ]; }
186
+ render() {
187
+ const post = this.post;
188
+ if (!post)
189
+ return nothing;
190
+ const photo = post.photos[this.index];
191
+ const many = post.photos.length > 1;
192
+ return html `<div class="body">
193
+ ${post.hiddenAt ? html `<div class="hidden">${t('gallery.text.hidden-note')}${post.hiddenReason ? ` · ${post.hiddenReason}` : ''}</div>` : nothing}
194
+ <div class="stage" @dblclick=${() => this.like(true, true)}>
195
+ ${photo ? html `<img src=${photo.fullpath} alt=${post.caption ?? ''} />` : nothing}
196
+ ${this.burst ? html `<md-icon class="burst" style="font-variation-settings:'FILL' 1">favorite</md-icon>` : nothing}
197
+ ${many
198
+ ? html `${this.index > 0 ? html `<button class="turn previous" aria-label=${t('gallery.button.previous')} @click=${() => (this.index -= 1)}><md-icon>chevron_left</md-icon></button>` : nothing}
199
+ ${this.index < post.photos.length - 1 ? html `<button class="turn next" aria-label=${t('gallery.button.next')} @click=${() => (this.index += 1)}><md-icon>chevron_right</md-icon></button>` : nothing}
200
+ <span class="index">${this.index + 1} / ${post.photos.length}</span>`
201
+ : nothing}
202
+ </div>
203
+
204
+ <div class="line">
205
+ <button
206
+ class="heart"
207
+ aria-pressed=${String(post.liked)}
208
+ aria-label=${t('gallery.button.like')}
209
+ ?disabled=${this.busy}
210
+ @click=${() => this.like(!post.liked)}
211
+ >
212
+ <md-icon>favorite</md-icon>
213
+ </button>
214
+ <button class="link" ?disabled=${!post.likeCount} @click=${() => this.showLikers()}>
215
+ ${t('gallery.text.like-count', { count: post.likeCount })}
216
+ </button>
217
+ <span class="spacer"></span>
218
+ <button class="link" @click=${() => this.go(`gallery-page?author=${post.creator?.id}`)}>
219
+ ${post.creator?.name ?? ''}
220
+ </button>
221
+ <span>${day(post.takenAt)}</span>
222
+ </div>
223
+ ${this.likers ? html `<div class="likers">${this.likers.map(one => one.name).join(', ')}</div>` : nothing}
224
+ ${post.caption ? html `<p class="caption">${post.caption}</p>` : nothing}
225
+
226
+ <div class="line">
227
+ ${post.event
228
+ ? html `<button class="link" @click=${() => this.go(`gallery-page?event=${post.event.id}`)}>
229
+ <md-icon>event</md-icon>${post.event.name} · ${days(post.event.startAt, post.event.endAt)}
230
+ </button>`
231
+ : nothing}
232
+ ${(post.tags ?? []).map(tag => html `<button class="link" @click=${() => this.go(`gallery-page?tag=${encodeURIComponent(tag)}`)}>#${tag}</button>`)}
233
+ ${post.space === 'PERSONAL' ? html `<span>${t('gallery.space.PERSONAL')}</span>` : nothing}
234
+ </div>
235
+
236
+ ${this.hiding
237
+ ? html `<div>
238
+ <textarea
239
+ maxlength="200"
240
+ placeholder=${t('gallery.text.hide-reason')}
241
+ .value=${this.reason}
242
+ @input=${(e) => (this.reason = e.target.value)}
243
+ ></textarea>
244
+ </div>`
245
+ : nothing}
246
+ </div>
247
+ <ox-popup-actions>
248
+ ${post.editable
249
+ ? html `<md-text-button ?disabled=${this.busy} @click=${() => this.edit()}
250
+ >${t('gallery.button.edit')}</md-text-button
251
+ >
252
+ <md-text-button ?disabled=${this.busy} @click=${() => this.deletePost()}
253
+ >${t('gallery.button.delete')}</md-text-button
254
+ >`
255
+ : nothing}
256
+ ${post.moderatable && !this.hiding
257
+ ? post.hiddenAt
258
+ ? html `<md-text-button ?disabled=${this.busy} @click=${() => this.unhide()}
259
+ >${t('gallery.button.unhide')}</md-text-button
260
+ >`
261
+ : html `<md-text-button ?disabled=${this.busy} @click=${() => (this.hiding = true)}
262
+ >${t('gallery.button.hide')}</md-text-button
263
+ >`
264
+ : nothing}
265
+ ${this.hiding
266
+ ? html `<md-text-button slot="cancel" @click=${() => (this.hiding = false)}
267
+ >${t('gallery.button.cancel')}</md-text-button
268
+ >
269
+ <md-filled-button
270
+ slot="confirm"
271
+ ?disabled=${this.busy || !this.reason.trim()}
272
+ @click=${() => this.hide()}
273
+ >${t('gallery.button.hide')}</md-filled-button
274
+ >`
275
+ : html `<md-filled-button slot="confirm" @click=${() => this.close()}
276
+ >${t('gallery.button.close')}</md-filled-button
277
+ >`}
278
+ </ox-popup-actions>`;
279
+ }
280
+ replace(post) {
281
+ this.post = post;
282
+ this.index = Math.min(this.index, Math.max(0, post.photos.length - 1));
283
+ galleryChanged();
284
+ }
285
+ /** Likes it, or takes the like back. A double press on the photo only likes - it never takes one back. */
286
+ async like(like, fromPhoto = false) {
287
+ const post = this.post;
288
+ if (fromPhoto) {
289
+ this.burst++;
290
+ setTimeout(() => (this.burst = 0), 600);
291
+ if (post.liked)
292
+ return;
293
+ }
294
+ this.busy = true;
295
+ try {
296
+ const state = await galleryApi.like(post.id, like);
297
+ this.post = { ...post, likeCount: state.likeCount, liked: state.liked };
298
+ if (this.likers)
299
+ this.likers = await galleryApi.likers(post.id);
300
+ this.dispatchEvent(new CustomEvent('gallery-liked', { detail: this.post, bubbles: true, composed: true }));
301
+ }
302
+ catch (error) {
303
+ notify({ level: 'error', message: reasonOf(error) });
304
+ }
305
+ finally {
306
+ this.busy = false;
307
+ }
308
+ }
309
+ async showLikers() {
310
+ if (this.likers) {
311
+ this.likers = undefined;
312
+ return;
313
+ }
314
+ try {
315
+ this.likers = await galleryApi.likers(this.post.id);
316
+ }
317
+ catch (error) {
318
+ notify({ level: 'error', message: reasonOf(error) });
319
+ }
320
+ }
321
+ edit() {
322
+ this.close({ edit: this.post });
323
+ }
324
+ async deletePost() {
325
+ const sure = await OxPrompt.open({
326
+ title: t('gallery.button.delete'),
327
+ text: t('gallery.text.delete-confirm'),
328
+ confirmButton: { text: t('gallery.button.delete') },
329
+ cancelButton: { text: t('gallery.button.cancel') }
330
+ });
331
+ if (!sure)
332
+ return;
333
+ this.busy = true;
334
+ try {
335
+ await galleryApi.remove(this.post.id);
336
+ notify({ message: t('gallery.text.deleted') });
337
+ galleryChanged();
338
+ this.close();
339
+ }
340
+ catch (error) {
341
+ notify({ level: 'error', message: reasonOf(error) });
342
+ }
343
+ finally {
344
+ this.busy = false;
345
+ }
346
+ }
347
+ async hide() {
348
+ this.busy = true;
349
+ try {
350
+ const own = this.post.editable;
351
+ this.replace(await galleryApi.hide(this.post.id, this.reason.trim()));
352
+ this.hiding = false;
353
+ this.reason = '';
354
+ /* Its owner is told - unless the one hiding it is its owner. */
355
+ notify({ message: own ? t('gallery.text.hidden-own') : t('gallery.text.hidden-done') });
356
+ }
357
+ catch (error) {
358
+ notify({ level: 'error', message: reasonOf(error) });
359
+ }
360
+ finally {
361
+ this.busy = false;
362
+ }
363
+ }
364
+ async unhide() {
365
+ this.busy = true;
366
+ try {
367
+ this.replace(await galleryApi.unhide(this.post.id));
368
+ }
369
+ catch (error) {
370
+ notify({ level: 'error', message: reasonOf(error) });
371
+ }
372
+ finally {
373
+ this.busy = false;
374
+ }
375
+ }
376
+ go(address) {
377
+ this.close({ go: address });
378
+ }
379
+ /** The next step - a page to go to, or the post to change - goes as the popup's result: the page takes it once the popup is gone. */
380
+ close(next) {
381
+ this.dispatchEvent(new CustomEvent('done', { detail: next, bubbles: true, composed: true }));
382
+ }
383
+ };
384
+ __decorate([
385
+ property({ attribute: false }),
386
+ __metadata("design:type", Object)
387
+ ], GalleryViewer.prototype, "post", void 0);
388
+ __decorate([
389
+ state(),
390
+ __metadata("design:type", Object)
391
+ ], GalleryViewer.prototype, "index", void 0);
392
+ __decorate([
393
+ state(),
394
+ __metadata("design:type", Array)
395
+ ], GalleryViewer.prototype, "likers", void 0);
396
+ __decorate([
397
+ state(),
398
+ __metadata("design:type", Object)
399
+ ], GalleryViewer.prototype, "hiding", void 0);
400
+ __decorate([
401
+ state(),
402
+ __metadata("design:type", Object)
403
+ ], GalleryViewer.prototype, "reason", void 0);
404
+ __decorate([
405
+ state(),
406
+ __metadata("design:type", Object)
407
+ ], GalleryViewer.prototype, "burst", void 0);
408
+ __decorate([
409
+ state(),
410
+ __metadata("design:type", Object)
411
+ ], GalleryViewer.prototype, "busy", void 0);
412
+ GalleryViewer = __decorate([
413
+ customElement('gallery-viewer')
414
+ ], GalleryViewer);
415
+ export { GalleryViewer };
416
+ //# sourceMappingURL=gallery-viewer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gallery-viewer.js","sourceRoot":"","sources":["../../client/components/gallery-viewer.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,OAAO,uCAAuC,CAAA;AAC9C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,4BAA4B,CAAA;AACnC,OAAO,oCAAoC,CAAA;AAE3C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OA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,EAAE;;4CAAkB;AACT;IAAhB,KAAK,EAAE;;2CAAqB;AAtKlB,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CAqXzB","sourcesContent":["/*\n * One post seen large (ADR-0165 decisions 4-6): its photos one by one, the like (the heart, or a double press on the\n * photo), who posted it and when, its event and tags - each opens the gallery narrowed to it. Its owner changes or\n * deletes it here; a moderator hides it here, with the reason, or shows it again. Where to go next is the popup's result\n * - a popup closes by going back in the history, so a page opened before it is gone would be gone with it.\n */\nimport '@material/web/button/filled-button.js'\nimport '@material/web/button/text-button.js'\nimport '@material/web/icon/icon.js'\nimport '@operato/popup/ox-popup-actions.js'\n\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { notify } from '@operato/layout'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { CommonPopupStyles, PopupBodyStyles } from '@operato/styles'\n\nimport { galleryApi, galleryChanged, type Post } from '../utils/gallery-api.js'\nimport { day, days, reasonOf, t } from '../utils/gallery-words.js'\n\n@customElement('gallery-viewer')\nexport class GalleryViewer extends localize(i18next)(LitElement) {\n static styles = [\n CommonPopupStyles,\n PopupBodyStyles,\n css`\n :host {\n height: 100%;\n }\n .body {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-medium, 8px);\n }\n .stage {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 240px;\n max-height: 62vh;\n background: var(--md-sys-color-surface-container-highest);\n border-radius: var(--border-radius, 4px);\n overflow: hidden;\n user-select: none;\n }\n .stage img {\n max-width: 100%;\n max-height: 62vh;\n object-fit: contain;\n display: block;\n }\n .stage .turn {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n display: inline-flex;\n padding: 4px;\n border: 0;\n border-radius: 50%;\n background: rgb(0 0 0 / 45%);\n color: #fff;\n cursor: pointer;\n }\n .stage .previous {\n inset-inline-start: var(--spacing-small, 4px);\n }\n .stage .next {\n inset-inline-end: var(--spacing-small, 4px);\n }\n .stage .index {\n position: absolute;\n bottom: var(--spacing-small, 4px);\n inset-inline-end: var(--spacing-medium, 8px);\n padding: 0 6px;\n border-radius: 999px;\n background: rgb(0 0 0 / 45%);\n color: #fff;\n font-size: var(--ui-t-small, 12px);\n }\n .burst {\n position: absolute;\n --md-icon-size: 72px;\n color: #fff;\n opacity: 0.9;\n animation: burst 600ms ease-out forwards;\n pointer-events: none;\n }\n @keyframes burst {\n from {\n transform: scale(0.6);\n opacity: 0.9;\n }\n to {\n transform: scale(1.3);\n opacity: 0;\n }\n }\n .line {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--spacing-small, 4px) var(--spacing-medium, 8px);\n font-size: var(--ui-t-small, 12px);\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n }\n .heart {\n display: inline-flex;\n align-items: center;\n gap: 2px;\n padding: 0;\n border: 0;\n background: none;\n color: var(--md-sys-color-on-surface);\n font: inherit;\n font-size: var(--ui-t-body, 14px);\n cursor: pointer;\n }\n /* The app's icons are drawn filled; an empty heart says not liked yet. */\n .heart md-icon {\n --md-icon-size: 22px;\n font-variation-settings: 'FILL' 0;\n }\n .heart[aria-pressed='true'] md-icon {\n color: var(--md-sys-color-error);\n font-variation-settings: 'FILL' 1;\n }\n .link {\n display: inline-flex;\n align-items: center;\n gap: 2px;\n padding: 0;\n border: 0;\n background: none;\n color: var(--md-sys-color-primary);\n font: inherit;\n cursor: pointer;\n }\n .link:hover {\n text-decoration: underline;\n }\n .link md-icon {\n --md-icon-size: 14px;\n }\n .caption {\n margin: 0;\n font-size: var(--ui-t-body, 14px);\n line-height: 1.6;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n color: var(--md-sys-color-on-surface);\n }\n .hidden {\n padding: var(--spacing-small, 4px) var(--spacing-medium, 8px);\n border-radius: var(--border-radius, 4px);\n background: var(--md-sys-color-error-container);\n color: var(--md-sys-color-on-error-container);\n font-size: var(--ui-t-small, 12px);\n }\n .likers {\n font-size: var(--ui-t-small, 12px);\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n }\n textarea {\n box-sizing: border-box;\n width: 100%;\n min-height: 56px;\n font: inherit;\n padding: var(--spacing-small, 4px) var(--spacing-medium, 8px);\n border: 1px solid var(--ui-line, var(--md-sys-color-outline-variant));\n border-radius: var(--border-radius, 4px);\n background: var(--md-sys-color-surface);\n color: var(--md-sys-color-on-surface);\n }\n .spacer {\n margin-inline-end: auto;\n }\n `\n ]\n\n @property({ attribute: false }) post!: Post\n\n @state() private index = 0\n @state() private likers?: { id: string; name?: string }[]\n @state() private hiding = false\n @state() private reason = ''\n @state() private burst = 0\n @state() private busy = false\n\n render() {\n const post = this.post\n if (!post) return nothing\n const photo = post.photos[this.index]\n const many = post.photos.length > 1\n return html`<div class=\"body\">\n ${post.hiddenAt ? html`<div class=\"hidden\">${t('gallery.text.hidden-note')}${post.hiddenReason ? ` · ${post.hiddenReason}` : ''}</div>` : nothing}\n <div class=\"stage\" @dblclick=${() => this.like(true, true)}>\n ${photo ? html`<img src=${photo.fullpath} alt=${post.caption ?? ''} />` : nothing}\n ${this.burst ? html`<md-icon class=\"burst\" style=\"font-variation-settings:'FILL' 1\">favorite</md-icon>` : nothing}\n ${\n many\n ? html`${this.index > 0 ? html`<button class=\"turn previous\" aria-label=${t('gallery.button.previous')} @click=${() => (this.index -= 1)}><md-icon>chevron_left</md-icon></button>` : nothing}\n ${this.index < post.photos.length - 1 ? html`<button class=\"turn next\" aria-label=${t('gallery.button.next')} @click=${() => (this.index += 1)}><md-icon>chevron_right</md-icon></button>` : nothing}\n <span class=\"index\">${this.index + 1} / ${post.photos.length}</span>`\n : nothing\n }\n </div>\n\n <div class=\"line\">\n <button\n class=\"heart\"\n aria-pressed=${String(post.liked)}\n aria-label=${t('gallery.button.like')}\n ?disabled=${this.busy}\n @click=${() => this.like(!post.liked)}\n >\n <md-icon>favorite</md-icon>\n </button>\n <button class=\"link\" ?disabled=${!post.likeCount} @click=${() => this.showLikers()}>\n ${t('gallery.text.like-count', { count: post.likeCount })}\n </button>\n <span class=\"spacer\"></span>\n <button class=\"link\" @click=${() => this.go(`gallery-page?author=${post.creator?.id}`)}>\n ${post.creator?.name ?? ''}\n </button>\n <span>${day(post.takenAt)}</span>\n </div>\n ${this.likers ? html`<div class=\"likers\">${this.likers.map(one => one.name).join(', ')}</div>` : nothing}\n ${post.caption ? html`<p class=\"caption\">${post.caption}</p>` : nothing}\n\n <div class=\"line\">\n ${\n post.event\n ? html`<button class=\"link\" @click=${() => this.go(`gallery-page?event=${post.event!.id}`)}>\n <md-icon>event</md-icon>${post.event.name} · ${days(post.event.startAt, post.event.endAt)}\n </button>`\n : nothing\n }\n ${(post.tags ?? []).map(tag => html`<button class=\"link\" @click=${() => this.go(`gallery-page?tag=${encodeURIComponent(tag)}`)}>#${tag}</button>`)}\n ${post.space === 'PERSONAL' ? html`<span>${t('gallery.space.PERSONAL')}</span>` : nothing}\n </div>\n\n ${\n this.hiding\n ? html`<div>\n <textarea\n maxlength=\"200\"\n placeholder=${t('gallery.text.hide-reason')}\n .value=${this.reason}\n @input=${(e: any) => (this.reason = e.target.value)}\n ></textarea>\n </div>`\n : nothing\n }\n </div>\n <ox-popup-actions>\n ${\n post.editable\n ? html`<md-text-button ?disabled=${this.busy} @click=${() => this.edit()}\n >${t('gallery.button.edit')}</md-text-button\n >\n <md-text-button ?disabled=${this.busy} @click=${() => this.deletePost()}\n >${t('gallery.button.delete')}</md-text-button\n >`\n : nothing\n }\n ${\n post.moderatable && !this.hiding\n ? post.hiddenAt\n ? html`<md-text-button ?disabled=${this.busy} @click=${() => this.unhide()}\n >${t('gallery.button.unhide')}</md-text-button\n >`\n : html`<md-text-button ?disabled=${this.busy} @click=${() => (this.hiding = true)}\n >${t('gallery.button.hide')}</md-text-button\n >`\n : nothing\n }\n ${\n this.hiding\n ? html`<md-text-button slot=\"cancel\" @click=${() => (this.hiding = false)}\n >${t('gallery.button.cancel')}</md-text-button\n >\n <md-filled-button\n slot=\"confirm\"\n ?disabled=${this.busy || !this.reason.trim()}\n @click=${() => this.hide()}\n >${t('gallery.button.hide')}</md-filled-button\n >`\n : html`<md-filled-button slot=\"confirm\" @click=${() => this.close()}\n >${t('gallery.button.close')}</md-filled-button\n >`\n }\n </ox-popup-actions>`\n }\n\n private replace(post: Post) {\n this.post = post\n this.index = Math.min(this.index, Math.max(0, post.photos.length - 1))\n galleryChanged()\n }\n\n /** Likes it, or takes the like back. A double press on the photo only likes - it never takes one back. */\n private async like(like: boolean, fromPhoto = false) {\n const post = this.post\n if (fromPhoto) {\n this.burst++\n setTimeout(() => (this.burst = 0), 600)\n if (post.liked) return\n }\n this.busy = true\n try {\n const state = await galleryApi.like(post.id, like)\n this.post = { ...post, likeCount: state.likeCount, liked: state.liked }\n if (this.likers) this.likers = await galleryApi.likers(post.id)\n this.dispatchEvent(new CustomEvent('gallery-liked', { detail: this.post, bubbles: true, composed: true }))\n } catch (error) {\n notify({ level: 'error', message: reasonOf(error) })\n } finally {\n this.busy = false\n }\n }\n\n private async showLikers() {\n if (this.likers) {\n this.likers = undefined\n return\n }\n try {\n this.likers = await galleryApi.likers(this.post.id)\n } catch (error) {\n notify({ level: 'error', message: reasonOf(error) })\n }\n }\n\n private edit() {\n this.close({ edit: this.post })\n }\n\n private async deletePost() {\n const sure = await OxPrompt.open({\n title: t('gallery.button.delete'),\n text: t('gallery.text.delete-confirm'),\n confirmButton: { text: t('gallery.button.delete') },\n cancelButton: { text: t('gallery.button.cancel') }\n })\n if (!sure) return\n this.busy = true\n try {\n await galleryApi.remove(this.post.id)\n notify({ message: t('gallery.text.deleted') })\n galleryChanged()\n this.close()\n } catch (error) {\n notify({ level: 'error', message: reasonOf(error) })\n } finally {\n this.busy = false\n }\n }\n\n private async hide() {\n this.busy = true\n try {\n const own = this.post.editable\n this.replace(await galleryApi.hide(this.post.id, this.reason.trim()))\n this.hiding = false\n this.reason = ''\n /* Its owner is told - unless the one hiding it is its owner. */\n notify({ message: own ? t('gallery.text.hidden-own') : t('gallery.text.hidden-done') })\n } catch (error) {\n notify({ level: 'error', message: reasonOf(error) })\n } finally {\n this.busy = false\n }\n }\n\n private async unhide() {\n this.busy = true\n try {\n this.replace(await galleryApi.unhide(this.post.id))\n } catch (error) {\n notify({ level: 'error', message: reasonOf(error) })\n } finally {\n this.busy = false\n }\n }\n\n private go(address: string) {\n this.close({ go: address })\n }\n\n /** The next step - a page to go to, or the post to change - goes as the popup's result: the page takes it once the popup is gone. */\n private close(next?: { go?: string; edit?: Post }) {\n this.dispatchEvent(new CustomEvent('done', { detail: next, bubbles: true, composed: true }))\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export { generateGalleryBadge, refreshGalleryBadge } from './utils/gallery-badge.js';
@@ -0,0 +1,2 @@
1
+ export { generateGalleryBadge, refreshGalleryBadge } from './utils/gallery-badge.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA","sourcesContent":["export { generateGalleryBadge, refreshGalleryBadge } from './utils/gallery-badge.js'\n"]}
@@ -0,0 +1,55 @@
1
+ import '@material/web/icon/icon.js';
2
+ import '@operato/input/ox-input-file.js';
3
+ import '../components/gallery-forms.js';
4
+ import '../components/gallery-uploader.js';
5
+ import '../components/gallery-viewer.js';
6
+ import { PageView } from '@operato/shell';
7
+ declare const GalleryPage_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
8
+ /**
9
+ * 갤러리 — the company's photos, its events, everyone's, and one's own (ADR-0165 decisions 2, 6). One page: the tabs are
10
+ * its ways in, and an event, a person or a tag narrows it (`?event=` · `?author=` · `?tag=`; `?post=` opens one post).
11
+ * Posting takes only photos - 「사진 올리기」, and on a phone 「찍기」 opens the camera at once.
12
+ */
13
+ export declare class GalleryPage extends GalleryPage_base {
14
+ static styles: import("lit").CSSResult[];
15
+ private tab;
16
+ private eventId?;
17
+ private authorId?;
18
+ private tag?;
19
+ private posts;
20
+ private total;
21
+ private events;
22
+ private tags;
23
+ private event?;
24
+ private loading;
25
+ private moderator;
26
+ private picker;
27
+ private camera;
28
+ private onChanged;
29
+ private get me();
30
+ get context(): {
31
+ title: string;
32
+ actions: any[];
33
+ };
34
+ render(): import("lit-html").TemplateResult<1>;
35
+ private get narrowed();
36
+ private renderNarrowing;
37
+ private renderPosts;
38
+ private renderEvents;
39
+ connectedCallback(): void;
40
+ disconnectedCallback(): void;
41
+ pageInitialized(): Promise<void>;
42
+ pageUpdated(changes: any, lifecycle: any): Promise<void>;
43
+ private filter;
44
+ private load;
45
+ /** Where a new post goes - the screen it is posted from. */
46
+ private preset;
47
+ private picked;
48
+ private upload;
49
+ private open;
50
+ private openById;
51
+ private replace;
52
+ private makeEvent;
53
+ private renameTag;
54
+ }
55
+ export {};