@tekkare/romulus 0.1.342 → 0.1.344

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/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.16.0"
6
6
  },
7
- "version": "0.1.341",
7
+ "version": "0.1.343",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -411,5 +411,5 @@ onBeforeUnmount(() => {
411
411
  </template>
412
412
 
413
413
  <style scoped>
414
- .rm-fbar{margin-inline:calc((min(var(--oip-content-max, 100%), 100%) - var(--oip-main-w, 100%))/2);position:sticky;width:var(--oip-main-w,100%);z-index:91;--rm-fbar-field-h:32px;backdrop-filter:blur(12px);background:color-mix(in srgb,var(--bg-surface-3) 80%,transparent);border-bottom:1px solid var(--border-default);display:flex;flex-direction:column;font-family:var(--font-sans)}.rm-fbar__band--summary{background:color-mix(in srgb,var(--bg-app) 92%,transparent);border-top:1px solid var(--border-default)}.rm-fbar__summary-row{max-width:100%;min-width:min(100%,var(--oip-content-max,100%));padding-block:var(--space-6);width:-moz-max-content;width:max-content}.rm-fbar__views{align-items:center;display:flex;flex:0 0 auto}.rm-fbar__views:empty{display:none}.rm-fbar__band{display:flex;justify-content:center;padding-inline:32px}.rm-fbar__rail-row,.rm-fbar__row{max-width:100%;min-width:min(100%,var(--oip-content-max,100%));width:-moz-max-content;width:max-content}.rm-fbar__row{align-items:flex-start;display:flex;gap:var(--space-12);padding-block:8px}.rm-fbar--open .rm-fbar__band:not(:has(~.rm-fbar__band--rail)){border-bottom:1px solid var(--border-default)}.rm-fbar__toggle :deep(p),.rm-fbar__toggle :deep(span){font-size:inherit;font-weight:inherit;line-height:inherit;margin:0}.rm-fbar__toggle{align-items:center;background:var(--bg-surface);border:1px solid var(--border-default);border-radius:var(--radius-pill);color:var(--text-primary);cursor:pointer;display:flex;flex:0 0 auto;font-family:inherit;font-size:var(--font-14);font-weight:var(--weight-medium);gap:var(--space-6);height:var(--rm-fbar-field-h);justify-content:center;padding:0 14px}.rm-fbar__toggle:hover{background:var(--bg-surface-3)}.rm-fbar__toggle.is-active,.rm-fbar__toggle.is-active:hover{background:var(--color-primary);border-color:var(--color-primary);color:var(--color-text-inverse)}.rm-fbar__toggle.is-active .rm-fbar__badge{background:var(--color-text-inverse);color:var(--color-primary)}.rm-fbar__badge{align-items:center;background:var(--color-primary);border-radius:16px;color:var(--color-text-inverse);display:inline-flex;font-size:var(--font-11);font-weight:var(--weight-bold);justify-content:center;min-width:18px;padding:0 5px}.rm-fbar__view{align-items:center;display:flex;flex:0 0 auto}.rm-fbar__advanced{align-items:center;background:none;border:none;border-left:1px solid var(--border-default);color:var(--color-primary);cursor:pointer;display:inline-flex;font-family:inherit;font-size:var(--font-13);font-weight:var(--weight-medium);height:var(--rm-fbar-field-h);padding:0 0 0 var(--space-12);position:absolute;right:14px;text-decoration-line:underline;top:0;white-space:nowrap;z-index:2}.rm-fbar__advanced.is-active,.rm-fbar__advanced:hover{color:var(--color-primary-hover,var(--color-primary));text-decoration-thickness:2px}.rm-fbar__rail-row{display:flex;padding-bottom:var(--space-8)}.rm-fbar--open .rm-fbar__band--rail{border-bottom:1px solid var(--border-default)}.rm-fbar__rail{align-items:center;display:flex;flex:0 1 auto;min-width:0;overflow-x:auto;scrollbar-width:thin}.rm-fbar__rail:empty{display:none}.rm-fbar__search{align-items:center;display:flex;flex:1 1 auto;gap:var(--space-8);min-width:0;position:relative}.rm-fbar__search:empty{display:none}.rm-fbar__search :deep(.rm-search-tags__field){border-radius:var(--radius-pill);box-sizing:border-box;height:var(--rm-fbar-field-h);padding-block:0;padding-right:calc(var(--rm-fbar-advanced-w, 0px) + 14px + var(--space-12))}.rm-fbar__search :deep(.rm-search-tags__field.is-open),.rm-fbar__search :deep(.rm-search-tags__field.is-panel){border-radius:var(--radius-pill)}.rm-fbar__search :deep(.rm-search-tags__list),.rm-fbar__search :deep(.rm-search-tags__panel){border-radius:var(--radius-2xl);border-top:1px solid var(--border-default);box-shadow:var(--shadow-lg);margin-top:var(--space-6);padding:var(--space-6)}.rm-fbar__search :deep(.rm-search-tags__option){border-radius:var(--radius-lg)}.rm-fbar__search :deep(.search-bar-wrapper){flex:1 1 auto;min-width:0}.rm-fbar__search :deep(.search-bar){background:var(--bg-surface);box-sizing:border-box;display:flex;height:var(--rm-fbar-field-h);width:100%}.rm-fbar__search :deep(.filters_input_search){border-radius:var(--radius-pill);box-sizing:border-box;height:auto;min-height:var(--rm-fbar-field-h);padding-right:calc(var(--rm-fbar-advanced-w, 0px) + var(--space-12));width:100%}.rm-fbar__search :deep(.research_tags:not(:has(*))){display:none}.rm-fbar__search :deep(.select_shortcut){box-sizing:border-box;font-size:var(--font-11);height:24px;padding-block:0}.rm-fbar__search :deep(.select_shortcut:hover){background:var(--bg-surface-3)!important;border-color:var(--border-default)!important;color:inherit!important}.rm-fbar__search :deep(.select_shortcut:hover svg){color:inherit!important}.rm-fbar__search :deep(.remove_search_section){border-left:none;border-radius:0 var(--radius-pill) var(--radius-pill) 0}.rm-fbar__search :deep(.remove_search_section:hover){background:transparent!important}.rm-fbar__search :deep(.remove_search_section:hover svg){color:var(--text-primary)!important}.rm-fbar__search :deep(.filters_input_search.no_bottom){border-bottom:1.5px solid var(--color-primary)!important;border-radius:var(--radius-pill)}.rm-fbar__search :deep(.search_suggestions){border:1px solid var(--border-default);border-radius:var(--radius-2xl);box-shadow:var(--shadow-lg);left:0;padding:var(--space-6);right:0;top:calc(100% + 6px);width:auto}.rm-fbar__search :deep(.sugg_container>*){border-radius:var(--radius-lg)}.rm-fbar__search :deep(.sugg_container>.selected){background:color-mix(in srgb,var(--color-primary) 6%,transparent)!important}.rm-fbar__panel{--rm-filter-col:224px;--rm-fbar-panel-field-h:40px;align-items:end;display:grid;gap:var(--space-8);grid-template-columns:repeat(auto-fit,minmax(0,var(--rm-filter-col)));justify-content:start;padding-block:16px 20px;padding-inline:max(32px,(100% - var(--oip-content-max,100%))/2 + 32px)}.rm-fbar__panel--wide{align-items:stretch;display:flex;flex-direction:column;gap:var(--space-12)}.rm-fbar__filters{display:contents}.rm-fbar__filters :deep(.filter-chip),.rm-fbar__filters :deep(.filter-complex__trigger),.rm-fbar__filters :deep(.rm-csel__field),.rm-fbar__filters :deep(.rm-dsel__field),.rm-fbar__filters :deep(.rm-msel__field),.rm-fbar__filters :deep(.rm-number__box){border-radius:var(--radius-lg);height:var(--rm-fbar-panel-field-h);width:100%}.rm-fbar__filters :deep(.rm-csel),.rm-fbar__filters :deep(.rm-dsel),.rm-fbar__filters :deep(.rm-msel){align-items:stretch;width:100%}.rm-fbar__panel-head{align-items:baseline;display:flex;gap:var(--space-16);grid-column:1/-1;width:100%}.rm-fbar__customize{grid-column:1/-1}.rm-fbar__panel :deep(.filters_row_break){grid-column:1/-1}.rm-fbar__panel-title{font-family:var(--font-serif);font-size:var(--font-18);font-weight:700;margin:0}.rm-fbar__action{background:none;border:none;cursor:pointer;font-family:inherit;font-size:var(--font-14);font-weight:var(--weight-medium);padding:0;text-decoration-line:underline}.rm-fbar__action--save{color:var(--color-primary)}.rm-fbar__action--clear{color:var(--color-danger)}.rm-fbar__action--clear:hover{opacity:.8;text-decoration-thickness:2px}.rm-fbar__action-sep{align-self:center;background:var(--border-default);height:14px;width:1px}
414
+ .rm-fbar{margin-inline:calc((min(var(--oip-content-max, 100%), 100%) - var(--oip-main-w, 100%))/2);position:sticky;width:var(--oip-main-w,100%);z-index:91;--rm-fbar-field-h:32px;backdrop-filter:blur(12px);background:color-mix(in srgb,var(--bg-surface-3) 80%,transparent);border-bottom:1px solid var(--border-default);display:flex;flex-direction:column;font-family:var(--font-sans)}.rm-fbar__band--summary{background:color-mix(in srgb,var(--color-primary) 4%,var(--bg-surface-3));border-top:1px solid var(--border-default)}.rm-fbar__summary-row{max-width:100%;min-width:min(100%,var(--oip-content-max,100%));padding-block:var(--space-6);width:-moz-max-content;width:max-content}.rm-fbar__views{align-items:center;display:flex;flex:0 0 auto}.rm-fbar__views:empty{display:none}.rm-fbar__band{display:flex;justify-content:center;padding-inline:32px}.rm-fbar__rail-row,.rm-fbar__row{max-width:100%;min-width:min(100%,var(--oip-content-max,100%));width:-moz-max-content;width:max-content}.rm-fbar__row{align-items:flex-start;display:flex;gap:var(--space-12);padding-block:8px}.rm-fbar--open .rm-fbar__band:not(:has(~.rm-fbar__band--rail)){border-bottom:1px solid var(--border-default)}.rm-fbar__toggle :deep(p),.rm-fbar__toggle :deep(span){font-size:inherit;font-weight:inherit;line-height:inherit;margin:0}.rm-fbar__toggle{align-items:center;background:var(--bg-surface);border:1px solid var(--border-default);border-radius:var(--radius-pill);color:var(--text-primary);cursor:pointer;display:flex;flex:0 0 auto;font-family:inherit;font-size:var(--font-14);font-weight:var(--weight-medium);gap:var(--space-6);height:var(--rm-fbar-field-h);justify-content:center;padding:0 14px}.rm-fbar__toggle:hover{background:var(--bg-surface-3)}.rm-fbar__toggle.is-active,.rm-fbar__toggle.is-active:hover{background:var(--color-primary);border-color:var(--color-primary);color:var(--color-text-inverse)}.rm-fbar__toggle.is-active .rm-fbar__badge{background:var(--color-text-inverse);color:var(--color-primary)}.rm-fbar__badge{align-items:center;background:var(--color-primary);border-radius:16px;color:var(--color-text-inverse);display:inline-flex;font-size:var(--font-11);font-weight:var(--weight-bold);justify-content:center;min-width:18px;padding:0 5px}.rm-fbar__view{align-items:center;display:flex;flex:0 0 auto}.rm-fbar__advanced{align-items:center;background:none;border:none;border-left:1px solid var(--border-default);color:var(--color-primary);cursor:pointer;display:inline-flex;font-family:inherit;font-size:var(--font-13);font-weight:var(--weight-medium);height:var(--rm-fbar-field-h);padding:0 0 0 var(--space-12);position:absolute;right:14px;text-decoration-line:underline;top:0;white-space:nowrap;z-index:2}.rm-fbar__advanced.is-active,.rm-fbar__advanced:hover{color:var(--color-primary-hover,var(--color-primary));text-decoration-thickness:2px}.rm-fbar__rail-row{display:flex;padding-bottom:var(--space-8)}.rm-fbar--open .rm-fbar__band--rail{border-bottom:1px solid var(--border-default)}.rm-fbar__rail{align-items:center;display:flex;flex:0 1 auto;min-width:0;overflow-x:auto;scrollbar-width:thin}.rm-fbar__rail:empty{display:none}.rm-fbar__search{align-items:center;display:flex;flex:1 1 auto;gap:var(--space-8);min-width:0;position:relative}.rm-fbar__search:empty{display:none}.rm-fbar__search :deep(.rm-search-tags__field){border-radius:var(--radius-pill);box-sizing:border-box;height:var(--rm-fbar-field-h);padding-block:0;padding-right:calc(var(--rm-fbar-advanced-w, 0px) + 14px + var(--space-12))}.rm-fbar__search :deep(.rm-search-tags__field.is-open),.rm-fbar__search :deep(.rm-search-tags__field.is-panel){border-radius:var(--radius-pill)}.rm-fbar__search :deep(.rm-search-tags__list),.rm-fbar__search :deep(.rm-search-tags__panel){border-radius:var(--radius-2xl);border-top:1px solid var(--border-default);box-shadow:var(--shadow-lg);margin-top:var(--space-6);padding:var(--space-6)}.rm-fbar__search :deep(.rm-search-tags__option){border-radius:var(--radius-lg)}.rm-fbar__search :deep(.search-bar-wrapper){flex:1 1 auto;min-width:0}.rm-fbar__search :deep(.search-bar){background:var(--bg-surface);box-sizing:border-box;display:flex;height:var(--rm-fbar-field-h);width:100%}.rm-fbar__search :deep(.filters_input_search){border-radius:var(--radius-pill);box-sizing:border-box;height:auto;min-height:var(--rm-fbar-field-h);padding-right:calc(var(--rm-fbar-advanced-w, 0px) + var(--space-12));width:100%}.rm-fbar__search :deep(.research_tags:not(:has(*))){display:none}.rm-fbar__search :deep(.select_shortcut){box-sizing:border-box;font-size:var(--font-11);height:24px;padding-block:0}.rm-fbar__search :deep(.select_shortcut:hover){background:var(--bg-surface-3)!important;border-color:var(--border-default)!important;color:inherit!important}.rm-fbar__search :deep(.select_shortcut:hover svg){color:inherit!important}.rm-fbar__search :deep(.remove_search_section){border-left:none;border-radius:0 var(--radius-pill) var(--radius-pill) 0}.rm-fbar__search :deep(.remove_search_section:hover){background:transparent!important}.rm-fbar__search :deep(.remove_search_section:hover svg){color:var(--text-primary)!important}.rm-fbar__search :deep(.filters_input_search.no_bottom){border-bottom:1.5px solid var(--color-primary)!important;border-radius:var(--radius-pill)}.rm-fbar__search :deep(.search_suggestions){border:1px solid var(--border-default);border-radius:var(--radius-2xl);box-shadow:var(--shadow-lg);left:0;padding:var(--space-6);right:0;top:calc(100% + 6px);width:auto}.rm-fbar__search :deep(.sugg_container>*){border-radius:var(--radius-lg)}.rm-fbar__search :deep(.sugg_container>.selected){background:color-mix(in srgb,var(--color-primary) 6%,transparent)!important}.rm-fbar__panel{--rm-filter-col:224px;--rm-fbar-panel-field-h:40px;align-items:end;display:grid;gap:var(--space-8);grid-template-columns:repeat(auto-fit,minmax(0,var(--rm-filter-col)));justify-content:start;padding-block:16px 20px;padding-inline:max(32px,(100% - var(--oip-content-max,100%))/2 + 32px)}.rm-fbar__panel--wide{align-items:stretch;display:flex;flex-direction:column;gap:var(--space-12)}.rm-fbar__filters{display:contents}.rm-fbar__filters :deep(.filter-chip),.rm-fbar__filters :deep(.filter-complex__trigger),.rm-fbar__filters :deep(.rm-csel__field),.rm-fbar__filters :deep(.rm-dsel__field),.rm-fbar__filters :deep(.rm-msel__field),.rm-fbar__filters :deep(.rm-number__box){border-radius:var(--radius-lg);height:var(--rm-fbar-panel-field-h);width:100%}.rm-fbar__filters :deep(.rm-csel),.rm-fbar__filters :deep(.rm-dsel),.rm-fbar__filters :deep(.rm-msel){align-items:stretch;width:100%}.rm-fbar__panel-head{align-items:baseline;display:flex;gap:var(--space-16);grid-column:1/-1;width:100%}.rm-fbar__customize{grid-column:1/-1}.rm-fbar__panel :deep(.filters_row_break){grid-column:1/-1}.rm-fbar__panel-title{font-family:var(--font-serif);font-size:var(--font-18);font-weight:700;margin:0}.rm-fbar__action{background:none;border:none;cursor:pointer;font-family:inherit;font-size:var(--font-14);font-weight:var(--weight-medium);padding:0;text-decoration-line:underline}.rm-fbar__action--save{color:var(--color-primary)}.rm-fbar__action--clear{color:var(--color-danger)}.rm-fbar__action--clear:hover{opacity:.8;text-decoration-thickness:2px}.rm-fbar__action-sep{align-self:center;background:var(--border-default);height:14px;width:1px}
415
415
  </style>
@@ -87,5 +87,5 @@ const pills = computed(() =>
87
87
  </template>
88
88
 
89
89
  <style scoped>
90
- .rm-fsum{display:flex;flex-wrap:wrap;gap:var(--space-6);list-style:none;margin:0;padding:0}.rm-fsum__pill{--rm-fsum-accent:var(--rm-shell-accent,var(--color-primary));align-items:center;background:color-mix(in srgb,var(--rm-fsum-accent) 16%,var(--rm-shell-surface,var(--bg-surface)));border:1px solid color-mix(in srgb,var(--rm-fsum-accent) 40%,transparent);border-radius:var(--radius-pill);color:var(--text-primary);display:inline-flex;font-size:var(--font-12);height:22px;max-width:300px;min-width:0;padding:0 2px 0 var(--space-8)}.rm-fsum__pill:hover{border-color:var(--rm-fsum-accent)}.rm-fsum__tip{min-width:0}.rm-fsum__open{align-items:center;background:none;border:none;color:inherit;cursor:pointer;display:inline-flex;font:inherit;max-width:100%;min-width:0;padding:0;white-space:nowrap}.rm-fsum__clear:focus-visible,.rm-fsum__open:focus-visible{border-radius:var(--radius-pill);outline:2px solid var(--color-primary);outline-offset:2px}.rm-fsum__clear{align-items:center;background:none;border:none;border-radius:50%;color:var(--text-secondary);cursor:pointer;display:inline-flex;flex:0 0 auto;height:16px;justify-content:center;margin-left:var(--space-4);padding:0;width:16px}.rm-fsum__clear:hover{background:color-mix(in srgb,var(--rm-fsum-accent) 30%,transparent);color:var(--text-primary)}.rm-fsum__label{color:var(--text-secondary);flex:0 0 auto;white-space:pre}.rm-fsum__value{font-weight:var(--weight-medium);min-width:0;overflow:hidden;text-overflow:ellipsis}.rm-fsum__list{list-style:none;margin:0;padding:0;white-space:normal}.rm-fsum__list li+li{margin-top:var(--space-2,2px)}
90
+ .rm-fsum{display:flex;flex-wrap:wrap;gap:var(--space-6);list-style:none;margin:0;padding:0}.rm-fsum__pill{--rm-fsum-tint:var(--color-primary);align-items:center;background:color-mix(in srgb,var(--rm-fsum-tint) 10%,var(--bg-surface-3));border:1px solid color-mix(in srgb,var(--rm-fsum-tint) 18%,var(--border-default));border-radius:var(--radius-md);color:var(--text-primary);display:inline-flex;font-size:var(--font-12);height:22px;max-width:300px;min-width:0;padding:0 2px 0 var(--space-8)}.rm-fsum__pill:hover{border-color:color-mix(in srgb,var(--rm-fsum-tint) 45%,var(--border-default))}.rm-fsum__tip{min-width:0}.rm-fsum__open{align-items:center;background:none;border:none;color:inherit;cursor:pointer;display:inline-flex;font:inherit;max-width:100%;min-width:0;padding:0;white-space:nowrap}.rm-fsum__clear:focus-visible,.rm-fsum__open:focus-visible{border-radius:var(--radius-sm);outline:2px solid var(--color-primary);outline-offset:2px}.rm-fsum__clear{align-items:center;background:none;border:none;border-radius:var(--radius-sm);color:var(--text-secondary);cursor:pointer;display:inline-flex;flex:0 0 auto;height:16px;justify-content:center;margin-left:var(--space-4);padding:0;width:16px}.rm-fsum__clear:hover{background:color-mix(in srgb,var(--rm-fsum-tint) 16%,transparent);color:var(--text-primary)}.rm-fsum__label{color:var(--text-secondary);flex:0 0 auto;white-space:pre}.rm-fsum__value{font-weight:var(--weight-medium);min-width:0;overflow:hidden;text-overflow:ellipsis}.rm-fsum__list{list-style:none;margin:0;padding:0;white-space:normal}.rm-fsum__list li+li{margin-top:var(--space-2,2px)}
91
91
  </style>
@@ -121,6 +121,19 @@ watch(() => cardExport?.value, (request) => {
121
121
  if (request && tool.value !== "Export") tool.value = "Export";
122
122
  });
123
123
 
124
+ /**
125
+ * Sources de la page : celles que l'app passe au panneau (son code), puis
126
+ * celles liees au sujet dans Directus. Panneau, notes et compteur de la tuile
127
+ * lisent la meme liste.
128
+ */
129
+ const pageSources = useOipPageSourceUuids(() => props.panelProps.Sources?.uuids as string[] | undefined);
130
+ const layerPanelProps = computed(() => {
131
+ const out = { ...props.panelProps };
132
+ if (out.Sources && !(out.Sources as any).sourceGroups?.length) out.Sources = { ...out.Sources, uuids: pageSources.uuids.value };
133
+ if (out.Notes) out.Notes = { ...out.Notes, sourceUuids: [...new Set([...((out.Notes.sourceUuids as string[]) ?? []), ...pageSources.fromDirectus.value])] };
134
+ return out;
135
+ });
136
+
124
137
  const config = useAppConfig().oip;
125
138
  const route = useRoute();
126
139
  const { locale, locales, setLocale } = useI18n();
@@ -362,6 +375,10 @@ const baseTiles = computed<(OipRailTile & { ownCount?: boolean })[]>(() => {
362
375
  const extra = {
363
376
  ...(entry.key === "Inbox" && inbox.newCount.value ? { count: inbox.newCount.value } : {}),
364
377
  ...(typeof state === "object" ? state : {}),
378
+ // Le compteur de la tuile Sources compte aussi les sources liees dans Directus.
379
+ ...(entry.key === "Sources" && typeof state === "object" && pageSources.fromDirectus.value.length
380
+ ? { count: (state.count ?? 0) + pageSources.fromDirectus.value.length }
381
+ : {}),
365
382
  };
366
383
  return {
367
384
  key: entry.key,
@@ -632,7 +649,7 @@ const tekkareLogo = tekkareLogoRaw.replaceAll('fill="#2100AD"', 'fill="currentCo
632
649
  v-else-if="openKey && LAYER_PANELS[openKey as OipRailTileKey]"
633
650
  :app-key="appKey"
634
651
  :super-admin="canAdmin"
635
- v-bind="panelProps[openKey as OipRailTileKey] ?? {}"
652
+ v-bind="layerPanelProps[openKey as OipRailTileKey] ?? {}"
636
653
  @close="tool = null"
637
654
  />
638
655
  <slot v-else name="tool" :active="openKey" />
@@ -187,7 +187,9 @@ const card = shallowRef<(CardExportRequest & { at: number }) | null>(null);
187
187
  * Declare les sources de la page a partir des uuids que le cadre suit deja
188
188
  * pour son panneau « Sources ». A appeler dans le `setup` du layout.
189
189
  */
190
- export function providePageExportSources(uuids: Ref<string[]>) {
190
+ export function providePageExportSources(codeUuids: Ref<string[]>) {
191
+ // Les memes sources que le panneau : le code, puis le sujet Directus.
192
+ const { uuids } = useOipPageSourceUuids(codeUuids);
191
193
  const { locale } = useI18n();
192
194
  const { load, exportSources } = useExportDirectusSources();
193
195
  const route = useRoute();
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Les sources de la page ouverte : celles que le code de l'app declare, puis
3
+ * celles liees au sujet de la page dans Directus (OipSubject_DataSource).
4
+ *
5
+ * Le code garde la main sur l'ordre : sa premiere source reste la principale
6
+ * (panneau « Sources », R-01). Une source liee seulement dans Directus vient
7
+ * apres, dans l'ordre de sa liaison. Une page dont le code ne declare rien
8
+ * prend donc ses sources dans Directus seul : c'est la cible, une source se
9
+ * rattache a une page sans deploiement.
10
+ *
11
+ * Une seule liste pour le panneau, le compteur de la tuile, les notes et les
12
+ * exports (R-03, R-04).
13
+ */
14
+ export const useOipPageSourceUuids = (codeUuids: MaybeRefOrGetter<string[] | undefined>) => {
15
+ const { subject, load } = useOipPageSubject();
16
+ const { status } = useAuth();
17
+ if (import.meta.client) watch(status, (s) => s === "authenticated" && load(), { immediate: true });
18
+
19
+ /** Sources liees au sujet dans Directus que le code ne declare pas. */
20
+ const fromDirectus = computed(() => {
21
+ const code = new Set(toValue(codeUuids) ?? []);
22
+ return [...new Set(subject.value?.sourceUuids ?? [])].filter((u) => u && !code.has(u));
23
+ });
24
+
25
+ const uuids = computed(() => [...(toValue(codeUuids) ?? []).filter(Boolean), ...fromDirectus.value]);
26
+
27
+ return { uuids, fromDirectus };
28
+ };
@@ -10,6 +10,8 @@ export interface OipSubjectRow {
10
10
  id: string;
11
11
  path: string;
12
12
  translations: { languages_code: string; name: string }[];
13
+ /** Sources liees au sujet dans Directus, dans l'ordre de leur liaison. */
14
+ sourceUuids?: string[];
13
15
  }
14
16
 
15
17
  let inflight: Promise<void> | null = null;
@@ -11,20 +11,28 @@ import { oipFavoritesDirectus, oipFavoritesUnavailable } from "../../utils/oipFa
11
11
  * l'origine du navigateur, qui differe en staging et en local. Le client
12
12
  * compare ensuite `relative_path` au chemin courant pour savoir quel sujet
13
13
  * est la page ouverte.
14
+ *
15
+ * `sourceUuids` : les sources liees au sujet dans Directus (OipSubject_DataSource),
16
+ * dans l'ordre de leur liaison. Le panneau « Sources » les ajoute a celles que
17
+ * le code de la page declare. Un jeton sans droit sur la liaison n'empeche pas
18
+ * de lire les sujets : on relit alors sans elle.
14
19
  */
15
20
  export default defineEventHandler(async (event) => {
16
21
  await requireOipSession(event);
17
22
  const appUrls = oipAppUrls();
18
23
  const { url, headers } = oipFavoritesDirectus();
19
24
 
20
- try {
21
- const response = await $fetch<{ data: any[] }>(`${url}/items/OipSubject`, {
25
+ const BASE = ["subject_id", "relative_path", "translations.languages_code", "translations.subject_name"];
26
+ const read = (fields: string[]) =>
27
+ $fetch<{ data: any[] }>(`${url}/items/OipSubject`, {
22
28
  headers,
23
- query: {
24
- limit: -1,
25
- filter: JSON.stringify({ app: { prod_url: { _in: appUrls } } }),
26
- fields: ["subject_id", "relative_path", "translations.languages_code", "translations.subject_name"].join(","),
27
- },
29
+ query: { limit: -1, filter: JSON.stringify({ app: { prod_url: { _in: appUrls } } }), fields: fields.join(",") },
30
+ });
31
+
32
+ try {
33
+ const response = await read([...BASE, "data_source.id", "data_source.DataSource_source_uuid"]).catch((error: any) => {
34
+ if (error?.statusCode === 403 || error?.status === 403) return read(BASE);
35
+ throw error;
28
36
  });
29
37
  return (response.data ?? []).map((row) => ({
30
38
  id: row.subject_id as string,
@@ -33,6 +41,10 @@ export default defineEventHandler(async (event) => {
33
41
  languages_code: String(t?.languages_code || "").trim(),
34
42
  name: t?.subject_name ?? "",
35
43
  })),
44
+ sourceUuids: [...(row.data_source ?? [])]
45
+ .sort((a: any, b: any) => (a?.id ?? 0) - (b?.id ?? 0))
46
+ .map((l: any) => l?.DataSource_source_uuid as string)
47
+ .filter(Boolean),
36
48
  }));
37
49
  } catch (error: any) {
38
50
  throw oipFavoritesUnavailable(error, "OipSubject") ?? error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/romulus",
3
- "version": "0.1.342",
3
+ "version": "0.1.344",
4
4
  "description": "Romulus Design System - Nuxt module by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",