@serene-pub/sdk 0.6.0-pr-1
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/LICENSE +202 -0
- package/NOTICE +17 -0
- package/README.md +368 -0
- package/dist/actions.d.ts +572 -0
- package/dist/actions.js +829 -0
- package/dist/annexFields.d.ts +234 -0
- package/dist/annexFields.js +413 -0
- package/dist/announce.d.ts +464 -0
- package/dist/announce.js +426 -0
- package/dist/attributes.d.ts +670 -0
- package/dist/attributes.js +904 -0
- package/dist/bands.d.ts +125 -0
- package/dist/bands.js +256 -0
- package/dist/builder.d.ts +683 -0
- package/dist/builder.js +677 -0
- package/dist/candidates.d.ts +109 -0
- package/dist/candidates.js +118 -0
- package/dist/capabilities.d.ts +744 -0
- package/dist/capabilities.js +679 -0
- package/dist/channels.d.ts +106 -0
- package/dist/channels.js +129 -0
- package/dist/clauses.d.ts +40 -0
- package/dist/clauses.js +43 -0
- package/dist/component.d.ts +33 -0
- package/dist/component.js +27 -0
- package/dist/componentBuild.d.ts +48 -0
- package/dist/componentBuild.js +84 -0
- package/dist/componentClient.d.ts +100 -0
- package/dist/componentClient.js +13 -0
- package/dist/componentImports.d.ts +51 -0
- package/dist/componentImports.js +106 -0
- package/dist/componentModule.d.ts +8 -0
- package/dist/componentModule.js +270 -0
- package/dist/componentWire.d.ts +130 -0
- package/dist/componentWire.js +280 -0
- package/dist/config.d.ts +295 -0
- package/dist/config.js +231 -0
- package/dist/connections.d.ts +89 -0
- package/dist/connections.js +131 -0
- package/dist/declarations.d.ts +290 -0
- package/dist/declarations.js +794 -0
- package/dist/descriptors.d.ts +1774 -0
- package/dist/descriptors.js +1329 -0
- package/dist/dev.d.ts +136 -0
- package/dist/dev.js +161 -0
- package/dist/document.d.ts +202 -0
- package/dist/document.js +312 -0
- package/dist/engines.d.ts +117 -0
- package/dist/engines.js +203 -0
- package/dist/eventMapLaws.d.ts +63 -0
- package/dist/eventMapLaws.js +128 -0
- package/dist/events.d.ts +554 -0
- package/dist/events.js +633 -0
- package/dist/executor.d.ts +771 -0
- package/dist/executor.js +1829 -0
- package/dist/extension.d.ts +448 -0
- package/dist/extension.js +315 -0
- package/dist/facets.d.ts +53 -0
- package/dist/facets.js +60 -0
- package/dist/foldedSections.d.ts +74 -0
- package/dist/foldedSections.js +161 -0
- package/dist/genres.d.ts +507 -0
- package/dist/genres.js +633 -0
- package/dist/guardedConnection.d.ts +138 -0
- package/dist/guardedConnection.js +341 -0
- package/dist/handlebarsReach.d.ts +122 -0
- package/dist/handlebarsReach.js +222 -0
- package/dist/hash.d.ts +146 -0
- package/dist/hash.js +166 -0
- package/dist/hookGrants.d.ts +47 -0
- package/dist/hookGrants.js +68 -0
- package/dist/hooks.d.ts +290 -0
- package/dist/hooks.js +113 -0
- package/dist/hostElements.d.ts +447 -0
- package/dist/hostElements.js +702 -0
- package/dist/i18n.d.ts +94 -0
- package/dist/i18n.js +123 -0
- package/dist/identity.d.ts +93 -0
- package/dist/identity.js +135 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +176 -0
- package/dist/layout.d.ts +194 -0
- package/dist/layout.js +40 -0
- package/dist/media.d.ts +202 -0
- package/dist/media.js +70 -0
- package/dist/messageBlocks.d.ts +487 -0
- package/dist/messageBlocks.js +683 -0
- package/dist/migration.d.ts +128 -0
- package/dist/migration.js +261 -0
- package/dist/names.d.ts +78 -0
- package/dist/names.js +136 -0
- package/dist/nodeInput.d.ts +399 -0
- package/dist/nodeInput.js +178 -0
- package/dist/participants.d.ts +291 -0
- package/dist/participants.js +252 -0
- package/dist/personGate.d.ts +62 -0
- package/dist/personGate.js +77 -0
- package/dist/pick.d.ts +84 -0
- package/dist/pick.js +103 -0
- package/dist/pluginHarness.d.ts +235 -0
- package/dist/pluginHarness.js +558 -0
- package/dist/pluginPermissions.d.ts +25 -0
- package/dist/pluginPermissions.js +97 -0
- package/dist/pluginRuleRef.d.ts +13 -0
- package/dist/pluginRuleRef.js +10 -0
- package/dist/predicates.d.ts +182 -0
- package/dist/predicates.js +249 -0
- package/dist/preview.d.ts +120 -0
- package/dist/preview.js +82 -0
- package/dist/promptBlocks.d.ts +130 -0
- package/dist/promptBlocks.js +197 -0
- package/dist/rankingDecisions.d.ts +60 -0
- package/dist/rankingDecisions.js +48 -0
- package/dist/receipt.d.ts +313 -0
- package/dist/receipt.js +60 -0
- package/dist/receiverRules.d.ts +24 -0
- package/dist/receiverRules.js +94 -0
- package/dist/refs.d.ts +117 -0
- package/dist/refs.js +137 -0
- package/dist/registry.d.ts +230 -0
- package/dist/registry.js +273 -0
- package/dist/review.d.ts +108 -0
- package/dist/review.js +97 -0
- package/dist/sampling.d.ts +152 -0
- package/dist/sampling.js +712 -0
- package/dist/scope.d.ts +65 -0
- package/dist/scope.js +128 -0
- package/dist/scripts.d.ts +243 -0
- package/dist/scripts.js +326 -0
- package/dist/sessionLayout.d.ts +339 -0
- package/dist/sessionLayout.js +503 -0
- package/dist/sessionSettings.d.ts +70 -0
- package/dist/sessionSettings.js +2 -0
- package/dist/settings.d.ts +501 -0
- package/dist/settings.js +604 -0
- package/dist/settingsSlot.d.ts +108 -0
- package/dist/settingsSlot.js +166 -0
- package/dist/shapes.d.ts +373 -0
- package/dist/shapes.js +408 -0
- package/dist/sheets.d.ts +165 -0
- package/dist/sheets.js +251 -0
- package/dist/statShapes.d.ts +96 -0
- package/dist/statShapes.js +112 -0
- package/dist/status.d.ts +103 -0
- package/dist/status.js +125 -0
- package/dist/storage.d.ts +145 -0
- package/dist/storage.js +33 -0
- package/dist/storyTime.d.ts +308 -0
- package/dist/storyTime.js +560 -0
- package/dist/surfaces.d.ts +501 -0
- package/dist/surfaces.js +292 -0
- package/dist/template.d.ts +312 -0
- package/dist/template.js +554 -0
- package/dist/templateCheck.d.ts +60 -0
- package/dist/templateCheck.js +516 -0
- package/dist/templateFit.d.ts +157 -0
- package/dist/templateFit.js +349 -0
- package/dist/templateIds.d.ts +138 -0
- package/dist/templateIds.js +144 -0
- package/dist/templateScopeAt.d.ts +131 -0
- package/dist/templateScopeAt.js +354 -0
- package/dist/testing.d.ts +177 -0
- package/dist/testing.js +383 -0
- package/dist/tokenizers.d.ts +113 -0
- package/dist/tokenizers.js +184 -0
- package/dist/turnLock.d.ts +96 -0
- package/dist/turnLock.js +79 -0
- package/dist/turnOrder.d.ts +143 -0
- package/dist/turnOrder.js +128 -0
- package/dist/validate.d.ts +74 -0
- package/dist/validate.js +1399 -0
- package/dist/values.d.ts +212 -0
- package/dist/values.js +390 -0
- package/dist/variables.d.ts +493 -0
- package/dist/variables.js +662 -0
- package/dist/verdicts.d.ts +275 -0
- package/dist/verdicts.js +348 -0
- package/dist/widgetDecls.d.ts +88 -0
- package/dist/widgetDecls.js +119 -0
- package/dist/widgets.d.ts +1527 -0
- package/dist/widgets.js +208 -0
- package/dist/wire.d.ts +126 -0
- package/dist/wire.js +140 -0
- package/dist/worldinfo.d.ts +150 -0
- package/dist/worldinfo.js +212 -0
- package/host-elements.d.ts +914 -0
- package/package.json +67 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Channels and lanes (ruling 2026-09-09) โ how a message's `channel` string is
|
|
3
|
+
* read, by core and by a plugin, using one implementation.
|
|
4
|
+
*
|
|
5
|
+
* ## The two halves of a channel string
|
|
6
|
+
*
|
|
7
|
+
* A **channel** is an organizational bucket the genre chooses arbitrarily and
|
|
8
|
+
* declares by slug (`SessionShape.channels`). A **lane** under that slug is
|
|
9
|
+
* runtime and open-ended: a lane exists because a pipeline wrote to it, and the
|
|
10
|
+
* genre's pipelines allocate and manage them. "One lane per agent, with the
|
|
11
|
+
* agentโlane map in the genre's extension data" and "five ongoing private
|
|
12
|
+
* conversations in the cell-phone channel, more later" are the same mechanism.
|
|
13
|
+
*
|
|
14
|
+
* **No lane count is declared anywhere.** A genre declares slugs; the number of
|
|
15
|
+
* lanes under one is a fact about what has been written, never a schema.
|
|
16
|
+
*
|
|
17
|
+
* ## Why the number is never the identity
|
|
18
|
+
*
|
|
19
|
+
* `main` is always the default channel and lane 1 is always the default lane, so
|
|
20
|
+
* a bare slug *is* `slug:1` and `main` *is* `main:1`. Lane 1 is written as the
|
|
21
|
+
* **bare slug** โ that is the canonical storage form โ which is why every row
|
|
22
|
+
* written before lanes existed is already correct and why there was no
|
|
23
|
+
* migration.
|
|
24
|
+
*
|
|
25
|
+
* The number is **multiplicity and order, never identity**: the slug is the
|
|
26
|
+
* reference, and `text-messages:3` is the third conversation in the cell-phone
|
|
27
|
+
* channel, not a channel called 3. A numeric id with a display slug was
|
|
28
|
+
* considered and rejected for exactly that reason โ it makes the ordinal
|
|
29
|
+
* load-bearing and the name decorative, which is backwards.
|
|
30
|
+
*
|
|
31
|
+
* Lane metadata โ a title, who is in it, whether it is still open โ is the
|
|
32
|
+
* genre's business and lives in its extension data. Core stores a string.
|
|
33
|
+
*
|
|
34
|
+
* ## Reading vs writing
|
|
35
|
+
*
|
|
36
|
+
* A read of a **bare slug** is the whole channel (every lane). A read of
|
|
37
|
+
* `slug:1` is the default lane alone. That is the one place the distinction
|
|
38
|
+
* between `parseChannel('main')` and `parseChannel('main:1')` matters, and it is
|
|
39
|
+
* what `explicit` carries: both are lane 1, but only one of them *asked* for a
|
|
40
|
+
* lane.
|
|
41
|
+
*
|
|
42
|
+
* A write always normalises through `formatChannel(parseChannel(x))`, so two
|
|
43
|
+
* spellings of the same lane cannot land in the column as two lanes.
|
|
44
|
+
*/
|
|
45
|
+
/** The channel every session has, whatever its genre declares. @experimental */
|
|
46
|
+
export declare const DEFAULT_CHANNEL = "main";
|
|
47
|
+
/** The lane every channel has. A bare slug means this one. @internal */
|
|
48
|
+
export declare const DEFAULT_LANE = 1;
|
|
49
|
+
/** A channel string, taken apart. @experimental */
|
|
50
|
+
export interface ChannelRef {
|
|
51
|
+
/** The genre-declared bucket. The reference; never a number. */
|
|
52
|
+
slug: string;
|
|
53
|
+
/** Which lane under it, 1-based. `1` for a bare slug. */
|
|
54
|
+
lane: number;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the text actually named a lane.
|
|
57
|
+
*
|
|
58
|
+
* `main` and `main:1` are the same lane and format identically, but they
|
|
59
|
+
* are different *reads*: the first is the whole channel and the second is
|
|
60
|
+
* its default lane. Without this the two are indistinguishable after
|
|
61
|
+
* parsing, and "read the phone" silently becomes "read the first phone
|
|
62
|
+
* conversation".
|
|
63
|
+
*/
|
|
64
|
+
explicit: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Why the text was not taken at face value, when it was not.
|
|
67
|
+
*
|
|
68
|
+
* Carried as a value rather than logged, because this function is pure and
|
|
69
|
+
* runs in a plugin sandbox as readily as in the host: the caller that has
|
|
70
|
+
* somewhere to put a warning is the one that decides to. Its presence never
|
|
71
|
+
* means the parse failed โ parsing a channel does not throw, on any input,
|
|
72
|
+
* because a malformed lane on a *read* must degrade to the default lane and
|
|
73
|
+
* not take a turn down with it.
|
|
74
|
+
*/
|
|
75
|
+
warning?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Take a stored or requested channel apart.
|
|
79
|
+
*
|
|
80
|
+
* Never throws. Absent, blank, or non-string is the default channel's default
|
|
81
|
+
* lane โ the session always has one, so there is nothing to refuse.
|
|
82
|
+
* @experimental
|
|
83
|
+
*/
|
|
84
|
+
export declare function parseChannel(raw: unknown): ChannelRef;
|
|
85
|
+
/**
|
|
86
|
+
* Write a channel back out in its canonical form.
|
|
87
|
+
*
|
|
88
|
+
* Lane 1 is the bare slug. This is the only shape that may reach the column: a
|
|
89
|
+
* row stored as `main:1` and a row stored as `main` would be one lane wearing
|
|
90
|
+
* two names, and every prefix read would then have to know both.
|
|
91
|
+
* @experimental
|
|
92
|
+
*/
|
|
93
|
+
export declare function formatChannel(ref: {
|
|
94
|
+
slug: string;
|
|
95
|
+
lane?: number;
|
|
96
|
+
}): string;
|
|
97
|
+
/**
|
|
98
|
+
* Whether two channel strings name the same lane.
|
|
99
|
+
*
|
|
100
|
+
* Canonical equality, so `main` and `main:1` are the same lane and `phone` and
|
|
101
|
+
* `phone:2` are not. `explicit` deliberately plays no part โ it says how a read
|
|
102
|
+
* was *phrased*, not which lane it landed on.
|
|
103
|
+
* @internal
|
|
104
|
+
*/
|
|
105
|
+
export declare function isSameChannel(a: unknown, b: unknown): boolean;
|
|
106
|
+
//# sourceMappingURL=channels.d.ts.map
|
package/dist/channels.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Channels and lanes (ruling 2026-09-09) โ how a message's `channel` string is
|
|
3
|
+
* read, by core and by a plugin, using one implementation.
|
|
4
|
+
*
|
|
5
|
+
* ## The two halves of a channel string
|
|
6
|
+
*
|
|
7
|
+
* A **channel** is an organizational bucket the genre chooses arbitrarily and
|
|
8
|
+
* declares by slug (`SessionShape.channels`). A **lane** under that slug is
|
|
9
|
+
* runtime and open-ended: a lane exists because a pipeline wrote to it, and the
|
|
10
|
+
* genre's pipelines allocate and manage them. "One lane per agent, with the
|
|
11
|
+
* agentโlane map in the genre's extension data" and "five ongoing private
|
|
12
|
+
* conversations in the cell-phone channel, more later" are the same mechanism.
|
|
13
|
+
*
|
|
14
|
+
* **No lane count is declared anywhere.** A genre declares slugs; the number of
|
|
15
|
+
* lanes under one is a fact about what has been written, never a schema.
|
|
16
|
+
*
|
|
17
|
+
* ## Why the number is never the identity
|
|
18
|
+
*
|
|
19
|
+
* `main` is always the default channel and lane 1 is always the default lane, so
|
|
20
|
+
* a bare slug *is* `slug:1` and `main` *is* `main:1`. Lane 1 is written as the
|
|
21
|
+
* **bare slug** โ that is the canonical storage form โ which is why every row
|
|
22
|
+
* written before lanes existed is already correct and why there was no
|
|
23
|
+
* migration.
|
|
24
|
+
*
|
|
25
|
+
* The number is **multiplicity and order, never identity**: the slug is the
|
|
26
|
+
* reference, and `text-messages:3` is the third conversation in the cell-phone
|
|
27
|
+
* channel, not a channel called 3. A numeric id with a display slug was
|
|
28
|
+
* considered and rejected for exactly that reason โ it makes the ordinal
|
|
29
|
+
* load-bearing and the name decorative, which is backwards.
|
|
30
|
+
*
|
|
31
|
+
* Lane metadata โ a title, who is in it, whether it is still open โ is the
|
|
32
|
+
* genre's business and lives in its extension data. Core stores a string.
|
|
33
|
+
*
|
|
34
|
+
* ## Reading vs writing
|
|
35
|
+
*
|
|
36
|
+
* A read of a **bare slug** is the whole channel (every lane). A read of
|
|
37
|
+
* `slug:1` is the default lane alone. That is the one place the distinction
|
|
38
|
+
* between `parseChannel('main')` and `parseChannel('main:1')` matters, and it is
|
|
39
|
+
* what `explicit` carries: both are lane 1, but only one of them *asked* for a
|
|
40
|
+
* lane.
|
|
41
|
+
*
|
|
42
|
+
* A write always normalises through `formatChannel(parseChannel(x))`, so two
|
|
43
|
+
* spellings of the same lane cannot land in the column as two lanes.
|
|
44
|
+
*/
|
|
45
|
+
/** The channel every session has, whatever its genre declares. @experimental */
|
|
46
|
+
export const DEFAULT_CHANNEL = 'main';
|
|
47
|
+
/** The lane every channel has. A bare slug means this one. @internal */
|
|
48
|
+
export const DEFAULT_LANE = 1;
|
|
49
|
+
/** A positive, whole lane number, or `undefined` if the value is not one. */
|
|
50
|
+
function readLane(value) {
|
|
51
|
+
if (typeof value === 'number')
|
|
52
|
+
return Number.isSafeInteger(value) && value >= 1 ? value : undefined;
|
|
53
|
+
if (typeof value !== 'string')
|
|
54
|
+
return undefined;
|
|
55
|
+
// Deliberately strict: `1.5`, `+2`, `1e3`, ` 2 ` (already trimmed by the
|
|
56
|
+
// caller) and an empty string are all *not* lane numbers. `Number()` would
|
|
57
|
+
// accept most of them and quietly invent a lane.
|
|
58
|
+
if (!/^[0-9]+$/.test(value))
|
|
59
|
+
return undefined;
|
|
60
|
+
const n = Number(value);
|
|
61
|
+
return Number.isSafeInteger(n) && n >= 1 ? n : undefined;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Take a stored or requested channel apart.
|
|
65
|
+
*
|
|
66
|
+
* Never throws. Absent, blank, or non-string is the default channel's default
|
|
67
|
+
* lane โ the session always has one, so there is nothing to refuse.
|
|
68
|
+
* @experimental
|
|
69
|
+
*/
|
|
70
|
+
export function parseChannel(raw) {
|
|
71
|
+
if (typeof raw !== 'string')
|
|
72
|
+
return { slug: DEFAULT_CHANNEL, lane: DEFAULT_LANE, explicit: false };
|
|
73
|
+
const text = raw.trim();
|
|
74
|
+
if (!text)
|
|
75
|
+
return { slug: DEFAULT_CHANNEL, lane: DEFAULT_LANE, explicit: false };
|
|
76
|
+
// The last colon, not the first: `:` is the lane separator, so a slug
|
|
77
|
+
// cannot contain one and splitting from the right is the same answer with
|
|
78
|
+
// one fewer way to be surprised.
|
|
79
|
+
const cut = text.lastIndexOf(':');
|
|
80
|
+
if (cut === -1)
|
|
81
|
+
return { slug: text, lane: DEFAULT_LANE, explicit: false };
|
|
82
|
+
const slug = text.slice(0, cut).trim();
|
|
83
|
+
const laneText = text.slice(cut + 1).trim();
|
|
84
|
+
if (!slug)
|
|
85
|
+
return {
|
|
86
|
+
slug: DEFAULT_CHANNEL,
|
|
87
|
+
lane: DEFAULT_LANE,
|
|
88
|
+
explicit: false,
|
|
89
|
+
warning: `'${raw}' names a lane with no channel in front of it โ read as ` +
|
|
90
|
+
`'${DEFAULT_CHANNEL}'. A lane is a lane *of* a channel; the slug is the reference.`,
|
|
91
|
+
};
|
|
92
|
+
const lane = readLane(laneText);
|
|
93
|
+
if (lane === undefined)
|
|
94
|
+
return {
|
|
95
|
+
slug,
|
|
96
|
+
lane: DEFAULT_LANE,
|
|
97
|
+
explicit: false,
|
|
98
|
+
warning: `'${raw}' has no readable lane number โ read as '${slug}', its default lane. ` +
|
|
99
|
+
`A lane is a whole number from 1 up.`,
|
|
100
|
+
};
|
|
101
|
+
return { slug, lane, explicit: true };
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Write a channel back out in its canonical form.
|
|
105
|
+
*
|
|
106
|
+
* Lane 1 is the bare slug. This is the only shape that may reach the column: a
|
|
107
|
+
* row stored as `main:1` and a row stored as `main` would be one lane wearing
|
|
108
|
+
* two names, and every prefix read would then have to know both.
|
|
109
|
+
* @experimental
|
|
110
|
+
*/
|
|
111
|
+
export function formatChannel(ref) {
|
|
112
|
+
const slug = (typeof ref.slug === 'string' ? ref.slug.trim() : '') || DEFAULT_CHANNEL;
|
|
113
|
+
const lane = readLane(ref.lane) ?? DEFAULT_LANE;
|
|
114
|
+
return lane === DEFAULT_LANE ? slug : `${slug}:${lane}`;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Whether two channel strings name the same lane.
|
|
118
|
+
*
|
|
119
|
+
* Canonical equality, so `main` and `main:1` are the same lane and `phone` and
|
|
120
|
+
* `phone:2` are not. `explicit` deliberately plays no part โ it says how a read
|
|
121
|
+
* was *phrased*, not which lane it landed on.
|
|
122
|
+
* @internal
|
|
123
|
+
*/
|
|
124
|
+
export function isSameChannel(a, b) {
|
|
125
|
+
const x = parseChannel(a);
|
|
126
|
+
const y = parseChannel(b);
|
|
127
|
+
return x.slug === y.slug && x.lane === y.lane;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=channels.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A gather clause's execution mode, as a setting rather than only an authoring
|
|
3
|
+
* choice (R-14: `mode` is a setting, the construct is the clause).
|
|
4
|
+
*
|
|
5
|
+
* `gather` chains are declared `parallel` or `sequential` by whoever wrote the
|
|
6
|
+
* spec, and until now that was the end of it. But the right answer is not a
|
|
7
|
+
* property of the pipeline โ it is a property of the machine it runs on and the
|
|
8
|
+
* provider it talks to. Four reads that overlap happily against a local
|
|
9
|
+
* database may want to be sequential against a rate-limited remote one, and the
|
|
10
|
+
* person who knows that is the administrator, not the author.
|
|
11
|
+
*
|
|
12
|
+
* So the author's declaration becomes the default and the user's setting wins,
|
|
13
|
+
* on exactly the terms `review` already uses (see `resolvePosition`): same
|
|
14
|
+
* `settings` slot, same precedence, same refusal to let an author forbid the
|
|
15
|
+
* override.
|
|
16
|
+
*/
|
|
17
|
+
import type { I18n } from './descriptors.js';
|
|
18
|
+
/** @experimental */
|
|
19
|
+
export type ClauseMode = 'parallel' | 'sequential';
|
|
20
|
+
/** @experimental */
|
|
21
|
+
export declare const CLAUSE_MODES: readonly ClauseMode[];
|
|
22
|
+
/**
|
|
23
|
+
* What the panel renders for a gather clause, declared here rather than written
|
|
24
|
+
* in the client.
|
|
25
|
+
*
|
|
26
|
+
* A clause is not a node definition, so it has no descriptor to carry its wording โ
|
|
27
|
+
* which would leave the one string on that control invented by whichever screen
|
|
28
|
+
* drew it. Naming it here keeps the rule that every label comes from the SDK,
|
|
29
|
+
* and means a host and a plugin's tooling say the same thing.
|
|
30
|
+
* @experimental
|
|
31
|
+
*/
|
|
32
|
+
export declare const CLAUSE_MODE_DECL: {
|
|
33
|
+
path: 'mode';
|
|
34
|
+
i18n: I18n;
|
|
35
|
+
description: I18n;
|
|
36
|
+
of: readonly ClauseMode[];
|
|
37
|
+
};
|
|
38
|
+
/** The author's declaration is the default; the user's setting wins. @experimental */
|
|
39
|
+
export declare function resolveClauseMode(authorDefault: string | undefined, userSetting: unknown): ClauseMode;
|
|
40
|
+
//# sourceMappingURL=clauses.d.ts.map
|
package/dist/clauses.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A gather clause's execution mode, as a setting rather than only an authoring
|
|
3
|
+
* choice (R-14: `mode` is a setting, the construct is the clause).
|
|
4
|
+
*
|
|
5
|
+
* `gather` chains are declared `parallel` or `sequential` by whoever wrote the
|
|
6
|
+
* spec, and until now that was the end of it. But the right answer is not a
|
|
7
|
+
* property of the pipeline โ it is a property of the machine it runs on and the
|
|
8
|
+
* provider it talks to. Four reads that overlap happily against a local
|
|
9
|
+
* database may want to be sequential against a rate-limited remote one, and the
|
|
10
|
+
* person who knows that is the administrator, not the author.
|
|
11
|
+
*
|
|
12
|
+
* So the author's declaration becomes the default and the user's setting wins,
|
|
13
|
+
* on exactly the terms `review` already uses (see `resolvePosition`): same
|
|
14
|
+
* `settings` slot, same precedence, same refusal to let an author forbid the
|
|
15
|
+
* override.
|
|
16
|
+
*/
|
|
17
|
+
/** @experimental */
|
|
18
|
+
export const CLAUSE_MODES = ['parallel', 'sequential'];
|
|
19
|
+
/**
|
|
20
|
+
* What the panel renders for a gather clause, declared here rather than written
|
|
21
|
+
* in the client.
|
|
22
|
+
*
|
|
23
|
+
* A clause is not a node definition, so it has no descriptor to carry its wording โ
|
|
24
|
+
* which would leave the one string on that control invented by whichever screen
|
|
25
|
+
* drew it. Naming it here keeps the rule that every label comes from the SDK,
|
|
26
|
+
* and means a host and a plugin's tooling say the same thing.
|
|
27
|
+
* @experimental
|
|
28
|
+
*/
|
|
29
|
+
export const CLAUSE_MODE_DECL = {
|
|
30
|
+
path: 'mode',
|
|
31
|
+
i18n: { en: 'Run' },
|
|
32
|
+
description: {
|
|
33
|
+
en: 'Whether the steps in this group run at the same time or one after another. Running together is faster; one at a time is gentler on a rate-limited provider.',
|
|
34
|
+
},
|
|
35
|
+
of: CLAUSE_MODES,
|
|
36
|
+
};
|
|
37
|
+
/** The author's declaration is the default; the user's setting wins. @experimental */
|
|
38
|
+
export function resolveClauseMode(authorDefault, userSetting) {
|
|
39
|
+
if (typeof userSetting === 'string' && CLAUSE_MODES.includes(userSetting))
|
|
40
|
+
return userSetting;
|
|
41
|
+
return authorDefault === 'sequential' ? 'sequential' : 'parallel';
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=clauses.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@serene-pub/sdk/component` โ what a COMPONENT imports from the SDK
|
|
3
|
+
* (ยง3.5, C6 P1). Experimental: grows additively until SDK 1.0 freezes it.
|
|
4
|
+
*
|
|
5
|
+
* A component runs in a UI worker and may import only `COMPONENT_IMPORTS`
|
|
6
|
+
* (`componentImports.ts`). The SDK's root barrel is not on that list โ it is
|
|
7
|
+
* the pipeline and plugin authoring surface, most of which a component
|
|
8
|
+
* never runs โ so the few runtime helpers a component does use, and the
|
|
9
|
+
* section types it reads, are re-exported here. Core's own components
|
|
10
|
+
* import this subpath and nothing else of the SDK's, so a clone of one
|
|
11
|
+
* compiles in-app from its source as it stands.
|
|
12
|
+
*
|
|
13
|
+
* Every name here is the root barrel's own, re-exported: `import { x } from
|
|
14
|
+
* '@serene-pub/sdk'` and from this subpath are the same binding.
|
|
15
|
+
*/
|
|
16
|
+
/** An action's stable identity (a verb's key in a row or a palette). */
|
|
17
|
+
export { actionIdentity } from './identity.js';
|
|
18
|
+
/** Display text (R-20): a plain string or a locale map, resolved. */
|
|
19
|
+
export { i18nText, type I18n } from './i18n.js';
|
|
20
|
+
/** The empty turn order a widget starts from before the host's first push. */
|
|
21
|
+
export { EMPTY_TURN_ORDER, type TurnOrderV1 } from './turnOrder.js';
|
|
22
|
+
/** The widget data contract's protocol version. */
|
|
23
|
+
export { WIDGET_PROTOCOL } from './widgets.js';
|
|
24
|
+
/** The folded sections a row's shown alternative carries, read from its metadata (B4). */
|
|
25
|
+
export { foldedSectionsOf } from './foldedSections.js';
|
|
26
|
+
export type { ComponentContext } from './componentClient.js';
|
|
27
|
+
/** A declined `request`'s error, and the `code` it may carry. */
|
|
28
|
+
export type { RequestDeclined } from './componentWire.js';
|
|
29
|
+
export type { RequestDeclineCode } from './surfaces.js';
|
|
30
|
+
export type { HostKeyEventDetail } from './hostElements.js';
|
|
31
|
+
export type { StatusText, WidgetActionReason } from './status.js';
|
|
32
|
+
export type { AuthorsNoteV1, AuthorsNoteValueV1, FoldedSectionPartDataV1, FoldedSectionV1, LayoutV1, MessageErrorConnectionV1, MessageErrorV1, MessageMetadataV1, MessagePartV1, MessageSwipesV1, MessageV1, SessionCharactersV1, SessionEntryV1, SessionStateV1, ViewerV1, WidgetAction, WidgetEvent, WidgetEventKind, WidgetRequestKind, WidgetRequests, } from './widgets.js';
|
|
33
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@serene-pub/sdk/component` โ what a COMPONENT imports from the SDK
|
|
3
|
+
* (ยง3.5, C6 P1). Experimental: grows additively until SDK 1.0 freezes it.
|
|
4
|
+
*
|
|
5
|
+
* A component runs in a UI worker and may import only `COMPONENT_IMPORTS`
|
|
6
|
+
* (`componentImports.ts`). The SDK's root barrel is not on that list โ it is
|
|
7
|
+
* the pipeline and plugin authoring surface, most of which a component
|
|
8
|
+
* never runs โ so the few runtime helpers a component does use, and the
|
|
9
|
+
* section types it reads, are re-exported here. Core's own components
|
|
10
|
+
* import this subpath and nothing else of the SDK's, so a clone of one
|
|
11
|
+
* compiles in-app from its source as it stands.
|
|
12
|
+
*
|
|
13
|
+
* Every name here is the root barrel's own, re-exported: `import { x } from
|
|
14
|
+
* '@serene-pub/sdk'` and from this subpath are the same binding.
|
|
15
|
+
*/
|
|
16
|
+
// โโ runtime helpers โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
17
|
+
/** An action's stable identity (a verb's key in a row or a palette). */
|
|
18
|
+
export { actionIdentity } from './identity.js';
|
|
19
|
+
/** Display text (R-20): a plain string or a locale map, resolved. */
|
|
20
|
+
export { i18nText } from './i18n.js';
|
|
21
|
+
/** The empty turn order a widget starts from before the host's first push. */
|
|
22
|
+
export { EMPTY_TURN_ORDER } from './turnOrder.js';
|
|
23
|
+
/** The widget data contract's protocol version. */
|
|
24
|
+
export { WIDGET_PROTOCOL } from './widgets.js';
|
|
25
|
+
/** The folded sections a row's shown alternative carries, read from its metadata (B4). */
|
|
26
|
+
export { foldedSectionsOf } from './foldedSections.js';
|
|
27
|
+
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** @experimental What a built component was built against (F1). Additive: a reader ignores fields it does not know. */
|
|
2
|
+
export interface ComponentBuiltAgainst {
|
|
3
|
+
/** The widget protocol (`WIDGET_PROTOCOL`) the artifact speaks. */
|
|
4
|
+
widgetProtocol: number;
|
|
5
|
+
/** The host-element vocabulary (`HOST_ELEMENTS_VERSION`, `major.minor`) it places elements from. */
|
|
6
|
+
hostElements: string;
|
|
7
|
+
/** `@serene-pub/sdk`'s version as the build resolved it โ for the reader, never compared. */
|
|
8
|
+
sdk?: string;
|
|
9
|
+
/** `@serene-pub/component-client`'s version as the build resolved it โ for the reader, never compared. */
|
|
10
|
+
componentClient?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @experimental (F1)
|
|
14
|
+
*
|
|
15
|
+
* The widget protocols this host mounts a component built for. A host that
|
|
16
|
+
* moves to a new protocol keeps the old one here for as long as it still
|
|
17
|
+
* speaks it; one it drops is refused, by name.
|
|
18
|
+
*/
|
|
19
|
+
export declare const HOST_WIDGET_PROTOCOLS: readonly number[];
|
|
20
|
+
/** @experimental The host-element vocabulary majors this host mounts a component built for (F1). */
|
|
21
|
+
export declare const HOST_ELEMENTS_MAJORS: readonly number[];
|
|
22
|
+
/** @experimental The contract this SDK's build records: the two versions that decide (F1). */
|
|
23
|
+
export declare function currentBuiltAgainst(versions?: {
|
|
24
|
+
sdk?: string;
|
|
25
|
+
componentClient?: string;
|
|
26
|
+
}): ComponentBuiltAgainst;
|
|
27
|
+
/**
|
|
28
|
+
* @experimental (F1)
|
|
29
|
+
*
|
|
30
|
+
* Why this host must NOT mount a component built against `builtAgainst`, as
|
|
31
|
+
* a sentence โ or `undefined` when it may. Absent (`undefined` / `null`) is
|
|
32
|
+
* a component from before the record, judged compatible; present but
|
|
33
|
+
* unreadable is refused, since a host cannot tell what it assumes.
|
|
34
|
+
*
|
|
35
|
+
* - a widget protocol the host does not speak: `built for widget protocol 3;
|
|
36
|
+
* this host speaks 2`;
|
|
37
|
+
* - a vocabulary major the host lacks: `built for host-element vocabulary
|
|
38
|
+
* 2.0; this host has 1.4`. A newer MINOR mounts (see
|
|
39
|
+
* {@link HOST_ELEMENTS_VERSION}).
|
|
40
|
+
*
|
|
41
|
+
* `host` defaults to this SDK's own contract.
|
|
42
|
+
*/
|
|
43
|
+
export declare function componentBuiltAgainstFinding(builtAgainst: unknown, host?: {
|
|
44
|
+
widgetProtocols?: readonly number[];
|
|
45
|
+
hostElementsMajors?: readonly number[];
|
|
46
|
+
hostElements?: string;
|
|
47
|
+
}): string | undefined;
|
|
48
|
+
//# sourceMappingURL=componentBuild.d.ts.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a built component was built AGAINST (F1): the host contract a
|
|
3
|
+
* compiled artifact assumes, recorded beside it so a host that has moved on
|
|
4
|
+
* refuses it with a sentence instead of mounting it into a failure nobody can
|
|
5
|
+
* read.
|
|
6
|
+
*
|
|
7
|
+
* An artifact bundles its own Svelte and its own copy of the component
|
|
8
|
+
* client, so a component compiled today keeps working as core updates โ
|
|
9
|
+
* except where the HOST's side drifts: the widget protocol (the verbs and the
|
|
10
|
+
* message kinds, {@link WIDGET_PROTOCOL}) and the host-element vocabulary
|
|
11
|
+
* (the `sp-*` tags and every attribute the receiver mirrors,
|
|
12
|
+
* {@link HOST_ELEMENTS_VERSION}). Those two decide; the package versions are
|
|
13
|
+
* recorded for the person reading a refusal, never compared.
|
|
14
|
+
*
|
|
15
|
+
* Recorded by the CLI's packager on each manifest component entry
|
|
16
|
+
* (`components[].builtAgainst`) and by the in-app compiler on each compile.
|
|
17
|
+
* An entry WITHOUT one predates the record and is judged compatible โ every
|
|
18
|
+
* component built before it was built for protocol 2, vocabulary 1.
|
|
19
|
+
*/
|
|
20
|
+
import { HOST_ELEMENTS_VERSION } from './hostElements.js';
|
|
21
|
+
import { WIDGET_PROTOCOL } from './widgets.js';
|
|
22
|
+
/**
|
|
23
|
+
* @experimental (F1)
|
|
24
|
+
*
|
|
25
|
+
* The widget protocols this host mounts a component built for. A host that
|
|
26
|
+
* moves to a new protocol keeps the old one here for as long as it still
|
|
27
|
+
* speaks it; one it drops is refused, by name.
|
|
28
|
+
*/
|
|
29
|
+
export const HOST_WIDGET_PROTOCOLS = Object.freeze([WIDGET_PROTOCOL]);
|
|
30
|
+
/** @experimental The host-element vocabulary majors this host mounts a component built for (F1). */
|
|
31
|
+
export const HOST_ELEMENTS_MAJORS = Object.freeze([vocabularyMajor(HOST_ELEMENTS_VERSION)]);
|
|
32
|
+
/** @experimental The contract this SDK's build records: the two versions that decide (F1). */
|
|
33
|
+
export function currentBuiltAgainst(versions = {}) {
|
|
34
|
+
return {
|
|
35
|
+
widgetProtocol: WIDGET_PROTOCOL,
|
|
36
|
+
hostElements: HOST_ELEMENTS_VERSION,
|
|
37
|
+
...(versions.sdk ? { sdk: versions.sdk } : {}),
|
|
38
|
+
...(versions.componentClient ? { componentClient: versions.componentClient } : {}),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function vocabularyMajor(v) {
|
|
42
|
+
if (typeof v !== 'string')
|
|
43
|
+
return undefined;
|
|
44
|
+
const m = /^(\d+)\.(\d+)$/.exec(v);
|
|
45
|
+
return m ? Number(m[1]) : undefined;
|
|
46
|
+
}
|
|
47
|
+
const list = (xs) => (xs.length === 1 ? String(xs[0]) : `${xs.slice(0, -1).join(', ')} or ${xs[xs.length - 1]}`);
|
|
48
|
+
/**
|
|
49
|
+
* @experimental (F1)
|
|
50
|
+
*
|
|
51
|
+
* Why this host must NOT mount a component built against `builtAgainst`, as
|
|
52
|
+
* a sentence โ or `undefined` when it may. Absent (`undefined` / `null`) is
|
|
53
|
+
* a component from before the record, judged compatible; present but
|
|
54
|
+
* unreadable is refused, since a host cannot tell what it assumes.
|
|
55
|
+
*
|
|
56
|
+
* - a widget protocol the host does not speak: `built for widget protocol 3;
|
|
57
|
+
* this host speaks 2`;
|
|
58
|
+
* - a vocabulary major the host lacks: `built for host-element vocabulary
|
|
59
|
+
* 2.0; this host has 1.4`. A newer MINOR mounts (see
|
|
60
|
+
* {@link HOST_ELEMENTS_VERSION}).
|
|
61
|
+
*
|
|
62
|
+
* `host` defaults to this SDK's own contract.
|
|
63
|
+
*/
|
|
64
|
+
export function componentBuiltAgainstFinding(builtAgainst, host = {}) {
|
|
65
|
+
if (builtAgainst === undefined || builtAgainst === null)
|
|
66
|
+
return undefined;
|
|
67
|
+
const protocols = host.widgetProtocols ?? HOST_WIDGET_PROTOCOLS;
|
|
68
|
+
const majors = host.hostElementsMajors ?? HOST_ELEMENTS_MAJORS;
|
|
69
|
+
const vocabulary = host.hostElements ?? HOST_ELEMENTS_VERSION;
|
|
70
|
+
const b = builtAgainst;
|
|
71
|
+
if (typeof builtAgainst !== 'object' || Array.isArray(builtAgainst))
|
|
72
|
+
return 'its build record (builtAgainst) is not readable, so this host cannot tell what it was built for';
|
|
73
|
+
if (typeof b.widgetProtocol !== 'number' || !Number.isInteger(b.widgetProtocol))
|
|
74
|
+
return 'its build record names no widget protocol, so this host cannot tell what it was built for';
|
|
75
|
+
if (!protocols.includes(b.widgetProtocol))
|
|
76
|
+
return `built for widget protocol ${b.widgetProtocol}; this host speaks ${list(protocols)}`;
|
|
77
|
+
const major = vocabularyMajor(b.hostElements);
|
|
78
|
+
if (major === undefined)
|
|
79
|
+
return 'its build record names no host-element vocabulary (major.minor), so this host cannot tell what it was built for';
|
|
80
|
+
if (!majors.includes(major))
|
|
81
|
+
return `built for host-element vocabulary ${b.hostElements}; this host has ${vocabulary}`;
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=componentBuild.js.map
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The component client's contract (ยง3.5, C3): what a remote component is
|
|
3
|
+
* handed. The host implements it in the page's UI worker over the widget
|
|
4
|
+
* wire โ the same sections a native widget reads off its context and a
|
|
5
|
+
* frame is posted, and the same verbs back โ and `@serene-pub/component-client`
|
|
6
|
+
* is how a component names it.
|
|
7
|
+
*
|
|
8
|
+
* A component module exports one mount function: it draws into `root`
|
|
9
|
+
* (placing elements from `SP_HOST_ELEMENTS`) and returns a cleanup.
|
|
10
|
+
*/
|
|
11
|
+
import type { ViewerV1, WidgetRequestKind, WidgetRequests, WidgetScopedSectionValues, WidgetSectionScope } from './widgets.js';
|
|
12
|
+
import type { TurnOrderV1 } from './turnOrder.js';
|
|
13
|
+
/** Every section the host pushes, as the latest value received. @experimental */
|
|
14
|
+
export interface ComponentSections {
|
|
15
|
+
session?: unknown;
|
|
16
|
+
messages?: unknown[];
|
|
17
|
+
/** Per-lane rows, when the widget declared channels. */
|
|
18
|
+
channels: Record<string, unknown[]>;
|
|
19
|
+
settings?: Record<string, unknown>;
|
|
20
|
+
actions?: unknown;
|
|
21
|
+
annex?: Record<string, unknown>;
|
|
22
|
+
props?: Record<string, unknown>;
|
|
23
|
+
theme?: {
|
|
24
|
+
theme: string;
|
|
25
|
+
mode: 'light' | 'dark';
|
|
26
|
+
};
|
|
27
|
+
/** The viewer's language code โ render a locale map with `i18nText(text, ctx.locale)`. */
|
|
28
|
+
locale?: string;
|
|
29
|
+
/** ๐ง Who is looking: `{ userId, isAdmin, isGuest }`. */
|
|
30
|
+
viewer?: ViewerV1;
|
|
31
|
+
/** The session's turn order: who is due, in order, and who could be (`turnOrder.v1`). */
|
|
32
|
+
turnOrder?: TurnOrderV1;
|
|
33
|
+
/**
|
|
34
|
+
* ๐ง The scoped sections this widget was granted, by their posted name
|
|
35
|
+
* (`session_full`, `session_state`, โฆ) โ the SDK's one table
|
|
36
|
+
* (`WidgetScopedSections`), each its section's `v1`.
|
|
37
|
+
*/
|
|
38
|
+
scoped: Partial<WidgetScopedSectionValues>;
|
|
39
|
+
/**
|
|
40
|
+
* ๐ง The scopes this widget holds, BARE (`session:state`, never
|
|
41
|
+
* `widget:session:state`) โ as the host last said (`grants`), on mount
|
|
42
|
+
* and whenever an admin's review changes them. `undefined` until the host
|
|
43
|
+
* says (and from a host that never does). So a component tells "this
|
|
44
|
+
* scope was not granted" (drawn as such) from "its section has not been
|
|
45
|
+
* posted yet" (drawn as loading) โ both of which are an absent `scoped`
|
|
46
|
+
* entry. Read one scope with {@link ComponentContext.granted}.
|
|
47
|
+
*/
|
|
48
|
+
grants?: readonly WidgetSectionScope[];
|
|
49
|
+
layout?: unknown;
|
|
50
|
+
/** The view state this widget saved last time, handed back once on mount. */
|
|
51
|
+
state?: unknown;
|
|
52
|
+
suspended: boolean;
|
|
53
|
+
}
|
|
54
|
+
/** @experimental */
|
|
55
|
+
export type ComponentSection = keyof ComponentSections | 'event' | 'strings';
|
|
56
|
+
/** @experimental */
|
|
57
|
+
export interface ComponentInvokeArgs {
|
|
58
|
+
messageId?: number;
|
|
59
|
+
payload?: Record<string, unknown>;
|
|
60
|
+
blockId?: string;
|
|
61
|
+
/** The text the press supplies โ a slash argument (`WidgetInvokeArgs.text`). */
|
|
62
|
+
text?: string;
|
|
63
|
+
}
|
|
64
|
+
/** @experimental */
|
|
65
|
+
export interface ComponentContext extends Readonly<ComponentSections> {
|
|
66
|
+
/** Called with the section's name whenever the host pushes one. */
|
|
67
|
+
subscribe(fn: (section: ComponentSection) => void): () => void;
|
|
68
|
+
/** Widget events (`message:created`, `layout:changed`, โฆ). */
|
|
69
|
+
onEvent(fn: (event: unknown) => void): () => void;
|
|
70
|
+
/** Press an action by key or identity, as the native `invoke` verb does. */
|
|
71
|
+
invoke(key: string, args?: ComponentInvokeArgs): void;
|
|
72
|
+
/**
|
|
73
|
+
* โณ Fire a function by name โ a form block's press, whose identity the
|
|
74
|
+
* outlet stamped and no venue need list (the native `action` verb).
|
|
75
|
+
*/
|
|
76
|
+
action(fn: string, messageId?: number, payload?: Record<string, unknown>, action?: string, blockId?: string): void;
|
|
77
|
+
/** Keep a little view state for the next mount (capped by the host). */
|
|
78
|
+
saveState(state: unknown): void;
|
|
79
|
+
/** Tell the host something went wrong; `fatal` shows the host's own notice. */
|
|
80
|
+
error(message: string, fatal?: boolean): void;
|
|
81
|
+
/** Ask the host for something ({@link WidgetRequests}); rejects when it declines. */
|
|
82
|
+
request<K extends WidgetRequestKind>(kind: K, params: WidgetRequests[K]['params']): Promise<WidgetRequests[K]['result']>;
|
|
83
|
+
/**
|
|
84
|
+
* ๐ง The viewer's translation of one of the component's own English
|
|
85
|
+
* strings โ the source until a translation arrives, when `subscribe` hears
|
|
86
|
+
* `strings` and a redraw shows it.
|
|
87
|
+
*/
|
|
88
|
+
t(source: string): string;
|
|
89
|
+
/**
|
|
90
|
+
* ๐ง Was `scope` granted? `true` or `false` once the host has said
|
|
91
|
+
* (`grants`); `undefined` before it has โ so `false` is the one answer
|
|
92
|
+
* that means "draw not granted", and `undefined` still means "wait".
|
|
93
|
+
*/
|
|
94
|
+
granted(scope: WidgetSectionScope): boolean | undefined;
|
|
95
|
+
}
|
|
96
|
+
/** What a component module exports: mount into `root`; return a cleanup. @experimental */
|
|
97
|
+
export type ComponentMountFn = (root: HTMLElement, ctx: ComponentContext) => void | (() => void);
|
|
98
|
+
/** Types a component's mount function; returns it unchanged. @experimental */
|
|
99
|
+
export declare const defineComponent: (fn: ComponentMountFn) => ComponentMountFn;
|
|
100
|
+
//# sourceMappingURL=componentClient.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The component client's contract (ยง3.5, C3): what a remote component is
|
|
3
|
+
* handed. The host implements it in the page's UI worker over the widget
|
|
4
|
+
* wire โ the same sections a native widget reads off its context and a
|
|
5
|
+
* frame is posted, and the same verbs back โ and `@serene-pub/component-client`
|
|
6
|
+
* is how a component names it.
|
|
7
|
+
*
|
|
8
|
+
* A component module exports one mount function: it draws into `root`
|
|
9
|
+
* (placing elements from `SP_HOST_ELEMENTS`) and returns a cleanup.
|
|
10
|
+
*/
|
|
11
|
+
/** Types a component's mount function; returns it unchanged. @experimental */
|
|
12
|
+
export const defineComponent = (fn) => fn;
|
|
13
|
+
//# sourceMappingURL=componentClient.js.map
|