@intentic/extension-ui 1.290.0 → 1.292.0

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/README.md CHANGED
@@ -29,6 +29,9 @@ authors is a marketplace-phase task.
29
29
 
30
30
  - [src/index.ts](src/index.ts), the whole surface: which components and helpers an extension may render with.
31
31
  - [src/format.ts](src/format.ts): the shared formatters, so two extensions render a duration the same way.
32
+ - [src/i18n.ts](src/i18n.ts): the extension's words. `extensionT(id)` is its translator, bound to its own slice of
33
+ the host's one message tree; `registerExtensionMessages` mounts a catalog, which is what the host does before
34
+ `activate` and what a test calling `activate` itself has to do instead.
32
35
 
33
36
  ## The one control worth calling out
34
37
 
package/dist/diff.js ADDED
@@ -0,0 +1,11 @@
1
+ // Generated by scripts/build.mjs: do not edit.
2
+ // The kit's diff entry point, off the same host bridge as ./index.js.
3
+ const host = globalThis.__intenticHost;
4
+ if (host === undefined) {
5
+ throw new Error("@intentic/extension-ui was loaded outside an intentic host: its helpers come from the app, not from this package.");
6
+ }
7
+ const m = host.modules["@intentic/extension-ui"];
8
+ export const diffSequence = m["diffSequence"];
9
+ export const pairEdits = m["pairEdits"];
10
+ export const similarity = m["similarity"];
11
+ export const wordDiff = m["wordDiff"];
package/dist/index.js CHANGED
@@ -65,12 +65,12 @@ export const StatStrip = m["StatStrip"];
65
65
  export const StatusBadge = m["StatusBadge"];
66
66
  export const StatusTally = m["StatusTally"];
67
67
  export const StepSection = m["StepSection"];
68
- export const TIME_WINDOWS = m["TIME_WINDOWS"];
69
68
  export const ToggleSwitch = m["ToggleSwitch"];
70
69
  export const activeLocale = m["activeLocale"];
71
70
  export const appLink = m["appLink"];
72
71
  export const browserOwnsClick = m["browserOwnsClick"];
73
72
  export const clipboardOf = m["clipboardOf"];
73
+ export const diffSequence = m["diffSequence"];
74
74
  export const errorMessage = m["errorMessage"];
75
75
  export const extensionT = m["extensionT"];
76
76
  export const fixStanceLook = m["fixStanceLook"];
@@ -88,10 +88,13 @@ export const isRenderableImage = m["isRenderableImage"];
88
88
  export const noticeFrom = m["noticeFrom"];
89
89
  export const noticeOf = m["noticeOf"];
90
90
  export const openForwardedPort = m["openForwardedPort"];
91
+ export const pairEdits = m["pairEdits"];
91
92
  export const seriesColor = m["seriesColor"];
93
+ export const similarity = m["similarity"];
92
94
  export const sinceOf = m["sinceOf"];
93
95
  export const timeAgo = m["timeAgo"];
94
96
  export const timeWindowWords = m["timeWindowWords"];
97
+ export const timeWindows = m["timeWindows"];
95
98
  export const ui = m["ui"];
96
99
  export const useAgentRunPick = m["useAgentRunPick"];
97
100
  export const useAsyncAction = m["useAsyncAction"];
@@ -108,3 +111,4 @@ export const useScrollReset = m["useScrollReset"];
108
111
  export const useStickyTop = m["useStickyTop"];
109
112
  export const useTheme = m["useTheme"];
110
113
  export const vAction = m["vAction"];
114
+ export const wordDiff = m["wordDiff"];
@@ -0,0 +1 @@
1
+ export { diffSequence, pairEdits, similarity, wordDiff, type Edit, type Op, type Segment, type SegmentKind } from "../../ui/src/lib/textDiff.js";
@@ -1,6 +1,12 @@
1
- import { type Locale } from "../../ui/src/i18n/index.js";
1
+ import { type Locale, type MessageTree } from "../../ui/src/i18n/index.js";
2
2
  import type { Ref } from "vue";
3
- export type ExtensionT = (key: string, values?: Record<string, unknown>) => string;
3
+ export type ExtensionT = (key: string, values?: Record<string, unknown>, plural?: number) => string;
4
4
  export declare const extensionT: (extensionId: string) => ExtensionT;
5
+ export declare const registerExtensionMessages: (extensionId: string, messages: {
6
+ readonly base: MessageTree;
7
+ readonly load: (locale: string) => Promise<{
8
+ readonly default: MessageTree;
9
+ }>;
10
+ }) => Promise<void>;
5
11
  export declare const activeLocale: Readonly<Ref<Locale>>;
6
12
  export type { Locale };
@@ -1,5 +1,6 @@
1
- export { AgentRunButton, type AgentRunAttempt, type AgentRunChoice, type AgentRunPicker, type ModelPicking, useAgentRunPick, type FixStanceLook, fixStanceLook, AnchoredOverlay, Avatar, Button, vAction, BarChart, BottomSheet, BrandMark, Card, clipboardOf, browserOwnsClick, appLink, openForwardedPort, ChangeStatusMark, type ChangeStatus, ui, Code, CodeField, ConfirmDialog, ContextMenu, CopyButton, StatusTally, type TallyItem, DagEditor, DagGraph, type DagEdge, type DagNode, DiffStat, DisclosureRow, FilterBar, Icon, type IconName, ImageView, InfoDialog, InfoHint, InfoTable, isRenderableImage, Markdown, MarkdownDocument, MarkdownFigure, Modal, type NavGroup, NavRail, NoteEditor, type NoteDraft, type NoteDraftOptions, useNoteDraft, useKeyedDraft, type NoticeModel, type NoticeTone, type NoticeAction, Notice, NoticeStack, Page, PageAction, PageHeader, ScrollFrame, PersonaFace, type PersonaLike, Picker, ProjectChip, type PickerGroup, type PickerOption, type PickerOptions, ProgressRing, RepoRail, type RepoRailAll, type RepoRailGroup, type RepoRailRow, ProseField, ResizeSeam, ResponsiveOverlay, Row, RowGroup, SearchBar, SegmentedControl, seriesColor, sinceOf, useLoadingReveal, SkeletonRows, SplitView, StatStrip, StatusBadge, type StatusVariant, StepSection, TIME_WINDOWS, type TimeWindow, timeWindowWords, useCompact, useDevice, useListNavigation, useNow, errorMessage, noticeFrom, noticeOf, useAsyncAction, useNarrow, useRailMemory, useScrollReset, type StickyTop, useStickyTop, useTheme, } from "../../ui/src/index.js";
1
+ export { AgentRunButton, type AgentRunAttempt, type AgentRunChoice, type AgentRunPicker, type ModelPicking, useAgentRunPick, type FixStanceLook, fixStanceLook, AnchoredOverlay, Avatar, Button, vAction, BarChart, BottomSheet, BrandMark, Card, clipboardOf, browserOwnsClick, appLink, openForwardedPort, ChangeStatusMark, type ChangeStatus, ui, Code, CodeField, ConfirmDialog, ContextMenu, CopyButton, StatusTally, type TallyItem, DagEditor, DagGraph, type DagEdge, type DagNode, DiffStat, DisclosureRow, FilterBar, Icon, type IconName, ImageView, InfoDialog, InfoHint, InfoTable, isRenderableImage, Markdown, MarkdownDocument, MarkdownFigure, Modal, type NavGroup, NavRail, NoteEditor, type NoteDraft, type NoteDraftOptions, useNoteDraft, useKeyedDraft, type NoticeModel, type NoticeTone, type NoticeAction, Notice, NoticeStack, Page, PageAction, PageHeader, ScrollFrame, PersonaFace, type PersonaLike, Picker, ProjectChip, type PickerGroup, type PickerOption, type PickerOptions, ProgressRing, RepoRail, type RepoRailAll, type RepoRailGroup, type RepoRailRow, ProseField, ResizeSeam, ResponsiveOverlay, Row, RowGroup, SearchBar, SegmentedControl, seriesColor, sinceOf, useLoadingReveal, SkeletonRows, SplitView, StatStrip, StatusBadge, type StatusVariant, StepSection, timeWindows, type TimeWindow, timeWindowWords, useCompact, useDevice, useListNavigation, useNow, errorMessage, noticeFrom, noticeOf, useAsyncAction, useNarrow, useRailMemory, useScrollReset, type StickyTop, useStickyTop, useTheme, } from "../../ui/src/index.js";
2
2
  export { formatBytes, formatDate, formatDateTime, formatDayMonth, formatDuration, formatTime, formatTimestamp, formatTokens, formatWeekdayTime, freshness, timeAgo, } from "./format.js";
3
+ export { diffSequence, pairEdits, similarity, wordDiff } from "./diff.js";
3
4
  export { activeLocale, extensionT } from "./i18n.js";
4
5
  export type { BarsFigure, BarsFigureItem, DagFigure, DagFigureEdge, DagFigureNode, Figure, FigureAccent, MermaidFigure, StatsFigure, StatsFigureItem, } from "../../ui/src/markdown/index.js";
5
6
  export { default as Checkbox } from "primevue/checkbox";
@@ -12,8 +12,8 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
12
12
  modelValue?: string | undefined;
13
13
  }) & {
14
14
  onAdd?: ((from: string) => any) | undefined;
15
- "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
16
15
  onConnect?: ((from: string, to: string) => any) | undefined;
16
+ "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
17
17
  onSelectEdge?: ((from: string, to: string) => any) | undefined;
18
18
  }> & (typeof globalThis extends {
19
19
  __VLS_PROPS_FALLBACK: infer P;
@@ -29,16 +29,16 @@ type __VLS_Slots = {} & {
29
29
  };
30
30
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
31
  cancel: () => any;
32
- save: () => any;
33
- remove: () => any;
34
32
  edit: () => any;
33
+ remove: () => any;
34
+ save: () => any;
35
35
  "update:source": (value: string) => any;
36
36
  "update:confirming": (value: boolean) => any;
37
37
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
38
38
  onCancel?: (() => any) | undefined;
39
- onSave?: (() => any) | undefined;
40
- onRemove?: (() => any) | undefined;
41
39
  onEdit?: (() => any) | undefined;
40
+ onRemove?: (() => any) | undefined;
41
+ onSave?: (() => any) | undefined;
42
42
  "onUpdate:source"?: ((value: string) => any) | undefined;
43
43
  "onUpdate:confirming"?: ((value: boolean) => any) | undefined;
44
44
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -17,7 +17,7 @@ export declare const setLocale: (locale: Locale) => Promise<void>;
17
17
  export declare const startI18n: () => Promise<void>;
18
18
  export declare const installI18n: (app: App) => void;
19
19
  export type TypedT = typeof i18n.global.t;
20
- export type LooseT = (key: string, values?: Record<string, unknown>) => string;
20
+ export type LooseT = (key: string, values?: Record<string, unknown>, plural?: number) => string;
21
21
  export declare function useT(): TypedT;
22
22
  export declare function useT(namespace: string): LooseT;
23
23
  export declare const t: TypedT;
@@ -71,7 +71,7 @@ export { useCompact } from "./components/layout/splitView.js";
71
71
  export { default as StatStrip } from "./components/charts/StatStrip.vue";
72
72
  export { default as StatusBadge, type StatusVariant } from "./components/feedback/StatusBadge.vue";
73
73
  export { default as StepSection } from "./components/layout/StepSection.vue";
74
- export { sinceOf, TIME_WINDOWS, type TimeWindow, timeWindowWords } from "./lib/timeWindow.js";
74
+ export { sinceOf, timeWindows, type TimeWindow, timeWindowWords } from "./lib/timeWindow.js";
75
75
  export { type IconName } from "./icons/iconSets.js";
76
76
  export { useDevice } from "./composables/useDevice.js";
77
77
  export { useNarrow } from "./composables/useNarrow.js";
@@ -0,0 +1,32 @@
1
+ export type SegmentKind = "same" | "added" | "removed";
2
+ export interface Segment {
3
+ readonly kind: SegmentKind;
4
+ readonly text: string;
5
+ }
6
+ export type Op<T> = {
7
+ readonly kind: "same";
8
+ readonly before: T;
9
+ readonly after: T;
10
+ } | {
11
+ readonly kind: "added" | "removed";
12
+ readonly item: T;
13
+ };
14
+ export declare const diffSequence: <T>(before: readonly T[], after: readonly T[], equal: (left: T, right: T) => boolean) => Op<T>[] | undefined;
15
+ export declare const wordDiff: (before: string, after: string) => Segment[];
16
+ export declare const similarity: (before: string, after: string) => number;
17
+ export type Edit<T> = {
18
+ readonly kind: "same";
19
+ readonly before: T;
20
+ readonly after: T;
21
+ } | {
22
+ readonly kind: "pair";
23
+ readonly before: T;
24
+ readonly after: T;
25
+ } | {
26
+ readonly kind: "removed";
27
+ readonly item: T;
28
+ } | {
29
+ readonly kind: "added";
30
+ readonly item: T;
31
+ };
32
+ export declare const pairEdits: <T>(ops: readonly Op<T>[], alike?: (before: T, after: T) => boolean) => Edit<T>[];
@@ -1,5 +1,5 @@
1
1
  export type TimeWindow = `1h` | `24h` | `7d` | `all`;
2
- export declare const TIME_WINDOWS: readonly {
2
+ export declare const timeWindows: () => readonly {
3
3
  label: string;
4
4
  value: TimeWindow;
5
5
  }[];
package/names.mjs CHANGED
@@ -24,6 +24,7 @@ export const extensionUiNames = [
24
24
  "DagEditor",
25
25
  "DagGraph",
26
26
  "DiffStat",
27
+ "diffSequence",
27
28
  "DisclosureRow",
28
29
  "errorMessage",
29
30
  "FilterBar",
@@ -75,6 +76,7 @@ export const extensionUiNames = [
75
76
  "SearchBar",
76
77
  "SegmentedControl",
77
78
  "seriesColor",
79
+ "similarity",
78
80
  "sinceOf",
79
81
  "SkeletonRows",
80
82
  "SplitView",
@@ -82,7 +84,7 @@ export const extensionUiNames = [
82
84
  "StatusBadge",
83
85
  "StatusTally",
84
86
  "StepSection",
85
- "TIME_WINDOWS",
87
+ "timeWindows",
86
88
  "timeAgo",
87
89
  "timeWindowWords",
88
90
  "ToggleSwitch",
@@ -96,9 +98,11 @@ export const extensionUiNames = [
96
98
  "useNarrow",
97
99
  "useNoteDraft",
98
100
  "useNow",
101
+ "pairEdits",
99
102
  "useRailMemory",
100
103
  "useScrollReset",
101
104
  "useStickyTop",
102
105
  "useTheme",
103
106
  "vAction",
107
+ "wordDiff",
104
108
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentic/extension-ui",
3
- "version": "1.290.0",
3
+ "version": "1.292.0",
4
4
  "description": "The UI kit intentic extensions render with, host-provided at runtime (the app's own components via the import map), so extension UI is always native to the shell",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -26,6 +26,11 @@
26
26
  "types": "./dist/types/extension-ui/src/index.d.ts",
27
27
  "default": "./dist/index.js"
28
28
  },
29
+ "./diff": {
30
+ "@intentic/src": "./src/diff.ts",
31
+ "types": "./dist/types/extension-ui/src/diff.d.ts",
32
+ "default": "./dist/diff.js"
33
+ },
29
34
  "./format": {
30
35
  "@intentic/src": "./src/format.ts",
31
36
  "types": "./dist/types/extension-ui/src/format.d.ts",
package/src/diff.ts ADDED
@@ -0,0 +1,4 @@
1
+ // The kit's diff machinery, reachable without the component barrel (see format.ts for why): edit scripts over any
2
+ // items, word-level segments between two texts, and the pairing of removals with additions. What a viewer that draws
3
+ // two versions of a file as one computes its marks with, so its redline agrees with the app's own prose diff.
4
+ export { diffSequence, pairEdits, similarity, wordDiff, type Edit, type Op, type Segment, type SegmentKind } from "@intentic/ui/diff";
package/src/i18n.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { activeLocale as active, type Locale, useT } from "@intentic/ui/i18n";
1
+ import { activeLocale as active, type Locale, type MessageTree, registerCatalog, useT } from "@intentic/ui/i18n";
2
2
  import type { Ref } from "vue";
3
3
 
4
4
  // The kit's translator, reachable without the component barrel: `index.ts` pulls in every .vue component, which breaks
@@ -13,8 +13,11 @@ import type { Ref } from "vue";
13
13
  /**
14
14
  * Translating an extension's own keys. A plain string rather than a checked union: an extension's catalog belongs to
15
15
  * its own package, and no schema on this side has ever seen it.
16
+ *
17
+ * `plural` picks between the forms a message separates with `|` — `t("rounds", { count }, count)` — and is the count
18
+ * the message interpolates, so English's two forms and Polish's three come out of the same call.
16
19
  */
17
- export type ExtensionT = (key: string, values?: Record<string, unknown>) => string;
20
+ export type ExtensionT = (key: string, values?: Record<string, unknown>, plural?: number) => string;
18
21
 
19
22
  /**
20
23
  * One extension's translator, bound to the slice of the message tree the host mounted its catalog under. Keys are its
@@ -33,6 +36,21 @@ export type ExtensionT = (key: string, values?: Record<string, unknown>) => stri
33
36
  */
34
37
  export const extensionT = (extensionId: string): ExtensionT => useT(`ext.${extensionId}`);
35
38
 
39
+ /**
40
+ * Mounts an extension's own messages under its slice of the tree — what the HOST does before it calls `activate`, and
41
+ * what a test that calls `activate` itself has to do instead, or every label it asserts on reads as a dotted key.
42
+ *
43
+ * ```ts
44
+ * await registerExtensionMessages(extensionIdOf(manifest), messages);
45
+ * ```
46
+ *
47
+ * `base` (English) is live the moment this returns; the promise resolves once the reader's actual language is in hand.
48
+ */
49
+ export const registerExtensionMessages = (
50
+ extensionId: string,
51
+ messages: { readonly base: MessageTree; readonly load: (locale: string) => Promise<{ readonly default: MessageTree }> },
52
+ ): Promise<void> => registerCatalog({ namespace: `ext.${extensionId}`, base: messages.base, load: (locale: string) => messages.load(locale) });
53
+
36
54
  /** The language on screen, for the rare contribution that formats something itself. Read-only: change it with nothing. */
37
55
  export const activeLocale: Readonly<Ref<Locale>> = active;
38
56
 
package/src/index.ts CHANGED
@@ -130,7 +130,7 @@ export {
130
130
  StatusBadge,
131
131
  type StatusVariant,
132
132
  StepSection,
133
- TIME_WINDOWS,
133
+ timeWindows,
134
134
  type TimeWindow,
135
135
  timeWindowWords,
136
136
  // Whether the enclosing `<SplitView>` has folded to compact; outside a split it falls back to device width.
@@ -169,6 +169,8 @@ export {
169
169
  freshness,
170
170
  timeAgo,
171
171
  } from "./format.js";
172
+ // Also reachable as `@intentic/extension-ui/diff`: the edit scripts a viewer marks two versions of a file with.
173
+ export { diffSequence, pairEdits, similarity, wordDiff } from "./diff.js";
172
174
  // The extension's own words. `extensionT(id)` is the translator for the catalog the host mounted from the module's
173
175
  // `messages` export; `activeLocale` is the language on screen, for a contribution that formats something itself.
174
176
  // The `Locale` type comes off `@intentic/extension-ui/i18n`, not from here: this file's re-exports become runtime