@ibgib/web-gib 0.0.42 → 0.0.43

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 (33) hide show
  1. package/dist/AUTO-GENERATED-version.d.mts +1 -1
  2. package/dist/AUTO-GENERATED-version.mjs +1 -1
  3. package/dist/api/commands/ui/ui-index.mjs +2 -2
  4. package/dist/api/commands/ui/ui-index.mjs.map +1 -1
  5. package/dist/api/commands/ui/update-css-variables.d.mts +13 -1
  6. package/dist/api/commands/ui/update-css-variables.d.mts.map +1 -1
  7. package/dist/api/commands/ui/update-css-variables.mjs +46 -36
  8. package/dist/api/commands/ui/update-css-variables.mjs.map +1 -1
  9. package/dist/identity/identity-constants.d.mts +72 -0
  10. package/dist/identity/identity-constants.d.mts.map +1 -0
  11. package/dist/identity/identity-constants.mjs +94 -0
  12. package/dist/identity/identity-constants.mjs.map +1 -0
  13. package/dist/identity/identity-types.d.mts +214 -0
  14. package/dist/identity/identity-types.d.mts.map +1 -0
  15. package/dist/identity/identity-types.mjs +17 -0
  16. package/dist/identity/identity-types.mjs.map +1 -0
  17. package/dist/ui/ui-helpers.d.mts +31 -0
  18. package/dist/ui/ui-helpers.d.mts.map +1 -1
  19. package/dist/ui/ui-helpers.mjs +50 -1
  20. package/dist/ui/ui-helpers.mjs.map +1 -1
  21. package/package.json +5 -5
  22. package/src/AUTO-GENERATED-version.mts +1 -1
  23. package/src/api/commands/ui/ui-index.mts +2 -2
  24. package/src/api/commands/ui/update-css-variables.mts +53 -35
  25. package/src/identity/identity-constants.mts +107 -0
  26. package/src/identity/identity-types.mts +250 -0
  27. package/src/ui/ui-helpers.mts +57 -1
  28. package/tools/auto-generated-agent-skills/skills/ibgib-create-app-core/templates/constants.mts.template +1 -1
  29. package/tools/auto-generated-agent-skills/skills/ibgib-create-app-core/templates/helpers.web.mts.template +3 -3
  30. package/tools/auto-generated-agent-skills/skills/ibgib-create-app-core/templates/index.mts.template +1 -1
  31. package/tools/auto-generated-agent-skills/skills/ibgib-create-app-core/templates/types.mts.template +1 -115
  32. package/tools/auto-generated-agent-skills/skills/ibgib-create-app-witness/templates/witness/app/app-v1.mts.template +1 -1
  33. package/tools/auto-generated-agent-skills/skills/ibgib-create-app-witness/templates/witness/app/helper.mts.template +1 -1
@@ -2,8 +2,9 @@ import { delay, extractErrorMsg, } from "@ibgib/helper-gib/dist/helpers/utils-he
2
2
 
3
3
  import { GLOBAL_LOG_A_LOT } from "../constants.mjs";
4
4
  import { UIThemeInfo } from "./ui-types.mjs";
5
- import { storageGet } from "../storage/storage-helpers.web.mjs";
5
+ import { storageGet, storagePut } from "../storage/storage-helpers.web.mjs";
6
6
  import { UI_THEME_INFO_KEY } from "./ui-constants.mjs";
7
+ import type { getGlobalDbName, getGlobalStoreName } from "../helpers.web.mjs";
7
8
 
8
9
  const logalot = GLOBAL_LOG_A_LOT;
9
10
 
@@ -182,6 +183,18 @@ export async function showFullscreenDialog(opts: {
182
183
  }
183
184
  }
184
185
 
186
+ /**
187
+ * Gets {@link UIThemeInfo} if it exists in the db ({@link dbName}) and store
188
+ * ({@link storeName}) at the given {@link key}.
189
+ *
190
+ * Used with libs\web-gib\src\api\commands\ui\update-css-variables.mts
191
+ *
192
+ * @see {@link putUIInfoInStore}
193
+ * @see {@link UI_THEME_INFO_KEY}
194
+ * @see {@link putUIInfoInStore}
195
+ * @see {@link getGlobalDbName}
196
+ * @see {@link getGlobalStoreName}
197
+ */
185
198
  export async function getExistingUIInfo({
186
199
  dbName,
187
200
  storeName,
@@ -220,3 +233,46 @@ export async function getExistingUIInfo({
220
233
  if (logalot) { console.log(`${lc} complete.`); }
221
234
  }
222
235
  }
236
+
237
+ /**
238
+ * Complementing {@link getExistingUIInfo}, this puts {@link newUIInfo} in the
239
+ * db ({@link dbName}) and into the store ({@link storeName}) at the given
240
+ * {@link key}.
241
+ *
242
+ * Used with libs\web-gib\src\api\commands\ui\update-css-variables.mts
243
+ *
244
+ * @see {@link getExistingUIInfo}
245
+ * @see {@link UI_THEME_INFO_KEY}
246
+ * @see {@link putUIInfoInStore}
247
+ * @see {@link getGlobalDbName}
248
+ * @see {@link getGlobalStoreName}
249
+ */
250
+ export async function putUIInfoInStore({
251
+ dbName,
252
+ storeName,
253
+ key = UI_THEME_INFO_KEY,
254
+ newUIInfo,
255
+ }: {
256
+ dbName: string,
257
+ storeName: string,
258
+ key?: string,
259
+ newUIInfo: UIThemeInfo,
260
+ }): Promise<void> {
261
+ const lc = `[${putUIInfoInStore.name}]`;
262
+ try {
263
+ if (logalot) { console.log(`${lc} starting... (I: 79c9ee707e426fd8c861c4ff4cf16826)`); }
264
+
265
+ await storagePut({
266
+ dbName,
267
+ storeName,
268
+ key,
269
+ value: JSON.stringify(newUIInfo),
270
+ });
271
+
272
+ } catch (error) {
273
+ console.error(`${lc} ${extractErrorMsg(error)}`);
274
+ throw error;
275
+ } finally {
276
+ if (logalot) { console.log(`${lc} complete.`); }
277
+ }
278
+ };
@@ -1,7 +1,7 @@
1
1
  import { tagTextToIb } from "@ibgib/core-gib/dist/common/other/ibgib-helper.mjs";
2
2
  import { ZERO_SPACE_ID } from "@ibgib/core-gib/dist/witness/space/space-constants.mjs";
3
3
 
4
- import { IbGibAmbientContextConfig } from "./types.mjs";
4
+ import { IbGibAmbientContextConfig } from "@ibgib/web-gib/dist/app-bootstrap/types.mjs";
5
5
 
6
6
  // ---------------------------------------------------------------------------
7
7
  // Logging / debug
@@ -18,11 +18,11 @@ import { delay } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
18
18
 
19
19
  import { GLOBAL_LOG_A_LOT } from "./constants.mjs";
20
20
  import { AUTO_GENERATED_VERSION } from "./AUTO-GENERATED-version.mjs";
21
- import {
21
+ import { IbGibGlobalThis_{{APP_CLASSNAME_PREFIX}} } from "./types.mjs";
22
+ import {
22
23
  IbGibAmbientContextConfig,
23
- IbGibGlobalThis_{{APP_CLASSNAME_PREFIX}},
24
24
  IbGibGlobalThis_Common,
25
- } from "./types.mjs";
25
+ } from "@ibgib/web-gib/dist/app-bootstrap/types.mjs";
26
26
 
27
27
  const logalot = GLOBAL_LOG_A_LOT;
28
28
 
@@ -20,7 +20,7 @@ const logalot = GLOBAL_LOG_A_LOT;
20
20
  * Sequence:
21
21
  * 1. Init IndexedDB storage
22
22
  * 2. (Optional) trigger shell / router
23
- * 3. Dynamically import bootstrap.mts — the heavy ibgib graph loads here
23
+ * 3. Dynamically import bootstrap.mjs — the heavy ibgib graph loads here
24
24
  */
25
25
  async function spinOffStartup(): Promise<void> {
26
26
  const lc = `[${spinOffStartup.name}]`;
@@ -1,118 +1,4 @@
1
- import { CommentData_V1 } from "@ibgib/core-gib/dist/common/comment/comment-types.mjs";
2
- import { MetaspaceService } from "@ibgib/core-gib/dist/witness/space/metaspace/metaspace-types.mjs";
3
- import { RCLIArgInfo } from "@ibgib/helper-gib/dist/rcli/rcli-types.mjs";
4
- import { IbGibRel8ns_V1, IbGib_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
5
- import { LiveProxyIbGib } from "@ibgib/web-gib/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.mjs";
6
- import { IbGibGlobalThisInfo } from "@ibgib/web-gib/dist/types.mjs";
7
-
8
- // ---------------------------------------------------------------------------
9
- // App-level ambient context config
10
- // ---------------------------------------------------------------------------
11
-
12
- /**
13
- * Configuration for the application's global state and storage substrates.
14
- */
15
- export interface IbGibAmbientContextConfig {
16
- /** Target IndexedDB database name */
17
- dbName: string;
18
- /** Primary object store name */
19
- storeName: string;
20
- /** Additional stores that need to be initialized (e.g., zero space ID) */
21
- additionalStoreNames?: string[];
22
- /** The IndexedDB key under which the AI API key is persisted */
23
- apiKeyName: string;
24
- }
25
-
26
- // ---------------------------------------------------------------------------
27
- // Bootstrap request comment (RCLI plumbing)
28
- // ---------------------------------------------------------------------------
29
-
30
- export interface RequestCommentData_V1 extends CommentData_V1 {
31
- args: string[];
32
- interpretedArgInfos: RCLIArgInfo[];
33
- }
34
-
35
- export interface RequestCommentRel8ns_V1 extends IbGibRel8ns_V1 {}
36
-
37
- /**
38
- * Special Comment that acts as a "request" — the command analog from RCLI.
39
- */
40
- export interface RequestCommentIbGib_V1
41
- extends IbGib_V1<RequestCommentData_V1, RequestCommentRel8ns_V1> {
42
- oneOff: boolean;
43
- }
44
-
45
- // ---------------------------------------------------------------------------
46
- // Space shim (RCLI pathing compat)
47
- // ---------------------------------------------------------------------------
48
-
49
- export interface SpaceShimGlobalInfo {
50
- initialCwd: string;
51
- cwd: string;
52
- }
53
-
54
- // ---------------------------------------------------------------------------
55
- // Identity (optional — only populate if the app uses identity)
56
- // ---------------------------------------------------------------------------
57
-
58
- /**
59
- * Framework-level identity interface.
60
- *
61
- * ## notes
62
- *
63
- * The implementation is entirely consumer-supplied. The framework only defines
64
- * the shape of the slot so that shells and components can react to auth state
65
- * without being coupled to a specific identity mechanism.
66
- *
67
- * For ibgib apps, the typical implementation will be keystone-based (a
68
- * Merkle DAG proof of identity), not token-based.
69
- */
70
- export interface IbGibIdentityContext {
71
- /** Whether identity resolution has completed (does not imply authenticated). */
72
- resolved: boolean;
73
- /** Whether the user has a verified identity in this session. */
74
- authenticated: boolean;
75
- /**
76
- * App-specific identity payload.
77
- * For ibgib: typically includes keystoneAddr, userIbGibAddr, etc.
78
- */
79
- data?: Record<string, any>;
80
- }
81
-
82
- // ---------------------------------------------------------------------------
83
- // GlobalThis state
84
- // ---------------------------------------------------------------------------
85
-
86
- /**
87
- * Base layer: fields shared across ALL ibgib web apps.
88
- *
89
- * NOTE: This is a superset of IbGibGlobalThisInfo from @ibgib/web-gib.
90
- * Intended to be upstreamed eventually.
91
- */
92
- export interface IbGibGlobalThis_Common extends IbGibGlobalThisInfo {
93
- bootstrapStarted?: boolean;
94
- bootstrapPromise?: Promise<void>;
95
- chronologysComponent?: any;
96
- }
97
-
98
- /**
99
- * Mid-layer: fields shared by any app that uses the ibgib App witness pattern.
100
- *
101
- * NOTE: Intended to be upstreamed into @ibgib/web-gib as IbGibGlobalThis_IbGibApp.
102
- */
103
- export interface IbGibGlobalThis_IbGibApp extends IbGibGlobalThis_Common {
104
- version?: string;
105
- spaceShim: { [spaceId: string]: SpaceShimGlobalInfo };
106
- verbose?: boolean;
107
- fnDefaultGetAPIKey: () => Promise<string>;
108
- initialCommentIbGib?: IbGib_V1;
109
- initialCommentIbGibProxy?: LiveProxyIbGib;
110
- /**
111
- * Optional. Populated by the consumer's resolveIdentity() callback.
112
- * Undefined = identity not configured. Null = unresolved/unauthenticated.
113
- */
114
- identity?: IbGibIdentityContext | null;
115
- }
1
+ import { IbGibGlobalThis_IbGibApp } from "@ibgib/web-gib/dist/app-bootstrap/types.mjs";
116
2
 
117
3
  // ---------------------------------------------------------------------------
118
4
  // App-specific globalThis — add only what this app uniquely needs below
@@ -17,7 +17,7 @@ import {
17
17
  isRequestComment,
18
18
  } from './{{APP_DIR_NAME}}-helper.mjs';
19
19
  import { PARAM_INFO_INTERACTIVE, {{APP_CLASSNAME_PREFIX}}Command } from './{{APP_DIR_NAME}}-constants.mjs';
20
- import { RequestCommentData_V1, RequestCommentIbGib_V1 } from '../../../types.mjs';
20
+ import { RequestCommentData_V1, RequestCommentIbGib_V1 } from "@ibgib/web-gib/dist/app-bootstrap/types.mjs";
21
21
 
22
22
  const logalot = GLOBAL_LOG_A_LOT;
23
23
 
@@ -7,7 +7,7 @@ import { TransformResult } from '@ibgib/ts-gib/dist/types.mjs';
7
7
  import { isComment } from '@ibgib/core-gib/dist/common/comment/comment-helper.mjs';
8
8
  import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
9
9
 
10
- import { RequestCommentData_V1, RequestCommentIbGib_V1 } from '../../../types.mjs';
10
+ import { RequestCommentData_V1, RequestCommentIbGib_V1 } from "@ibgib/web-gib/dist/app-bootstrap/types.mjs";
11
11
 
12
12
  /**
13
13
  * Validates that no duplicate parameter identifiers exist in the config.