@ibgib/web-gib 0.0.36 → 0.0.42

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/CHANGELOG.md CHANGED
@@ -3,13 +3,24 @@
3
3
  _note: as you implement features/fixes/etc., please document them here under the "Working Version" section. These will be moved to a concrete version number during the next publish._
4
4
 
5
5
  ## Working Version
6
+
7
+ ## 0.0.37-42
8
+ * chore: centralized build orchestration
9
+ * migrated build, clean, and test logic to the root `@ibgib/build-gib` orchestrator.
10
+ * pruned legacy `package.json` scripts and archived them in `docs/ARCHIVE_SCRIPTS.md`.
11
+ * updated `prepare:publish` to use the centralized build engine.
12
+ * documented the new **Monorepo Build Policy** in the README.
6
13
  * progress: genai package dep testing chain build
7
14
  * the package.json file no longer had a direct ref to @google/genai
8
15
  or a dev dependency to node types. I'm trying to troubleshoot this by
9
16
  adding back genai to package.json and doing a chain publish from web-gib.
10
17
  I want to see if that chain publish is removing deps or if this happened
11
18
  previously when we streamlined the monorepo.
19
+ * meta: architecture and agent skill modernization
20
+ * updated `README.md` to document the new 8-file foundational bootstrap architecture.
21
+ * modernized `ibgib-create-app-core` and `ibgib-create-shell` agent skills to support the new `script.mts` pattern.
22
+ * established the three-phase bootstrap standard (`script.mts` -> `index.mts` -> `bootstrap.mts`).
12
23
 
13
- ## 0.0.x
24
+ ## 0.0.36
14
25
  * working on pulling out common app code from blank-gib into this lib
15
26
  for use among multiple apps.
package/README.md CHANGED
@@ -4,6 +4,19 @@
4
4
 
5
5
  This library enables ibgib apps with...
6
6
 
7
+ ## Build (Monorepo Policy)
8
+
9
+ > [!IMPORTANT]
10
+ > This project is part of a monorepo. Build and development tasks are centralized in the monorepo root via the `@ibgib/build-gib` orchestrator.
11
+
12
+ ### Development & Build
13
+ Run these from the monorepo root:
14
+ * `npm run build:web-gib` - Performs a full clean and build.
15
+ * `npm run test:web-gib` - Runs the full respec-gib test suite for this library.
16
+
17
+ ### Legacy Scripts
18
+ Individual package scripts have been streamlined to avoid redundancy. Previous scripts are archived in `docs/ARCHIVE_SCRIPTS.md` at the monorepo root.
19
+
7
20
  * initializing the ibgib environment
8
21
  * bootstrapping the metaspace
9
22
  * utilizing and interacting with IndexedDB
@@ -64,6 +77,109 @@ Or for the direct script approach:
64
77
  }
65
78
  ```
66
79
 
80
+ ## Bootstrapping an IbGib App
81
+
82
+ `@ibgib/web-gib` provides a streamlined, multi-phase bootstrap process that minimizes boilerplate while maximizing performance. A standard ibgib application consists of **8 foundational files**:
83
+
84
+ 1. `index.html`: The entry point with script tags for `script.mjs` and `index.mjs`.
85
+ 2. `script.mts`: **Phase 1**. Immediate UI Shell initialization (e.g., burger menus).
86
+ 3. `index.mts`: **Phase 2**. Storage (IndexedDB) and Engine orchestration.
87
+ 4. `bootstrap.mts`: **Phase 3**. The heavy ibgib engine and App witness loading.
88
+ 5. `constants.mts`: App-specific configuration and UUIDs.
89
+ 6. `types.mts`: App-specific global state typing.
90
+ 7. `helpers.web.mts`: Environment-aware initialization utilities.
91
+ 8. `style.css`: Core application styling.
92
+
93
+ ### Phase 1: Immediate Shell Interactivity (`script.mts`)
94
+
95
+ To ensure the UI is responsive immediately, the Shell is initialized in a dedicated entry point. This script runs as soon as the HTML is parsed.
96
+
97
+ ```typescript
98
+ import { getMyAppShellSvc } from "./ui/shell/my-app-shell-service.mjs";
99
+
100
+ // Early init of UI Shell logic so the burger menu responds immediately.
101
+ getMyAppShellSvc();
102
+ ```
103
+
104
+ ### Phase 2: Environment Orchestration (`index.mts`)
105
+
106
+ The `index.mts` file handles the asynchronous setup of storage and triggers the dynamic loading of the heavy ibgib engine.
107
+
108
+ In your app's entry point (`index.mts`), you should initialize the global namespace immediately, then "spin off" the storage and bootstrap loading to avoid blocking the initial DOM paint.
109
+
110
+ ```typescript
111
+ import {
112
+ initIbGibStorage,
113
+ initIbGibGlobalThis,
114
+ dynamicallyLoadBootstrapScript
115
+ } from '@ibgib/web-gib/dist/app-bootstrap/init-orchestration.mjs';
116
+
117
+ import { APP_CONFIG } from './constants.mjs';
118
+ import { simpleIbGibRouterSingleton as router } from './ui/router/router-one-file.mjs';
119
+
120
+ // 1. Initialize global namespace immediately
121
+ initIbGibGlobalThis(APP_CONFIG, 'my_app_key');
122
+
123
+ /**
124
+ * spin off to avoid forestalling the DOMContentLoaded from firing
125
+ */
126
+ async function spinOffStartup(): Promise<void> {
127
+ document.addEventListener('DOMContentLoaded', async () => {
128
+ // 2. Prepare storage (IndexedDB)
129
+ await initIbGibStorage(APP_CONFIG);
130
+
131
+ // 3. Initialize Router
132
+ router.loadCurrentURLPath();
133
+
134
+ // 4. Defer loading the heavy engine
135
+ await dynamicallyLoadBootstrapScript('./bootstrap.mjs', 'bootstrapMyApp');
136
+ });
137
+ }
138
+
139
+ spinOffStartup();
140
+ ```
141
+
142
+ ### Phase 2: Dynamic Engine Bootstrap (`bootstrap.mts`)
143
+
144
+ The `bootstrap.mts` file is loaded dynamically. It handles the initialization of the metaspace, identity, and the application witness using a rich set of lifecycle hooks.
145
+
146
+ ```typescript
147
+ import { bootstrapIbGibApp } from '@ibgib/web-gib/dist/app-bootstrap/bootstrap.mjs';
148
+ import { getIbGibGlobalThis_IbGibApp } from '@ibgib/web-gib/dist/app-bootstrap/init-orchestration.mjs';
149
+
150
+ import {
151
+ APP_CONFIG,
152
+ TAG_AGENT_TEXT, TAG_AGENT_ICON, TAG_AGENT_DESCRIPTION,
153
+ MY_APP_SPACE_PREFIX
154
+ } from './constants.mjs';
155
+ import { MyAppApp_V1 } from './witness/app/my-app-app-v1.mjs';
156
+ import { PARAM_INFOS } from './witness/app/my-app-constants.mjs';
157
+ import { DEFAULT_MY_APP_DATA_V1 } from './witness/app/my-app-types.mjs';
158
+ import { registerAgentFunctionInfos } from './api/function-infos.web.mjs';
159
+
160
+ export async function bootstrapMyApp() {
161
+ await bootstrapIbGibApp({
162
+ config: APP_CONFIG,
163
+ // Bridge function that provides the typed globalThis for your app
164
+ getGlobalThis: (config) => getIbGibGlobalThis_IbGibApp('my_app_key', config),
165
+ AppClass: MyAppApp_V1,
166
+ defaultAppData: DEFAULT_MY_APP_DATA_V1,
167
+ paramInfos: PARAM_INFOS,
168
+ // Lifecycle hooks
169
+ registerAgentFunctionInfos,
170
+ ensureTags: [
171
+ { text: TAG_AGENT_TEXT, icon: TAG_AGENT_ICON, description: TAG_AGENT_DESCRIPTION }
172
+ ],
173
+ localSpaceNamePrefix: MY_APP_SPACE_PREFIX,
174
+ onReady: async (app) => {
175
+ console.log('Engine ready!');
176
+ // Initialize your UI shell service here
177
+ // getAppShellSvc().onEngineReady();
178
+ }
179
+ });
180
+ }
181
+ ```
182
+
67
183
  ## UI Architecture: Custom @ibgib component framework
68
184
 
69
185
  **tl;dr**: _Web Component-based components react to ibgib's unique Merkle DAG DLT time-centric data model._
@@ -10,5 +10,5 @@
10
10
  /**
11
11
  * this is the version of this package, auto-updated in the build process
12
12
  */
13
- export declare const AUTO_GENERATED_VERSION = "0.0.36";
13
+ export declare const AUTO_GENERATED_VERSION = "0.0.42";
14
14
  //# sourceMappingURL=AUTO-GENERATED-version.d.mts.map
@@ -10,5 +10,5 @@
10
10
  /**
11
11
  * this is the version of this package, auto-updated in the build process
12
12
  */
13
- export const AUTO_GENERATED_VERSION = '0.0.36';
13
+ export const AUTO_GENERATED_VERSION = '0.0.42';
14
14
  //# sourceMappingURL=AUTO-GENERATED-version.mjs.map
@@ -97,6 +97,21 @@ export interface IbGibIdentityContext {
97
97
  */
98
98
  data?: Record<string, any>;
99
99
  }
100
+ /**
101
+ * Minimal interface for an application's UI Shell.
102
+ *
103
+ * ## design notes
104
+ *
105
+ * This is intentionally minimal to avoid coupling the bootstrap engine to a
106
+ * specific UI design (header, panels, etc.).
107
+ */
108
+ export interface IbGibAppShell {
109
+ /**
110
+ * Hook called by the bootstrap engine when the ibGib engine and metaspace
111
+ * are fully initialized and ready for interaction.
112
+ */
113
+ onEngineReady(): void;
114
+ }
100
115
  /**
101
116
  * Layer 1: Fields shared across ALL ibgib web apps.
102
117
  *
@@ -133,6 +148,11 @@ export interface IbGibGlobalThis_Common extends IbGibGlobalThisInfo {
133
148
  export interface IbGibGlobalThis_IbGibApp extends IbGibGlobalThis_Common {
134
149
  /** Semver string generated at build time. */
135
150
  version?: string;
151
+ /**
152
+ * The application's UI Shell service.
153
+ * Initialized by the consumer and registered on the globalThis.
154
+ */
155
+ shell?: IbGibAppShell;
136
156
  /** Per-space RCLI pathing shim. */
137
157
  spaceShim: {
138
158
  [spaceId: string]: SpaceShimGlobalInfo;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/app-bootstrap/types.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,uDAAuD,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAEzE,OAAO,EAAE,cAAc,EAAE,MAAM,2DAA2D,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAMnD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,yBAAyB;IACtC,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAC;CACtB;AAMD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,GAAG,EAAE,MAAM,CAAC;CACf;AAMD,0CAA0C;AAC1C,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IACzD,8CAA8C;IAC9C,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,kCAAkC;IAClC,mBAAmB,EAAE,WA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G;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAMD;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC1B;;;OAGG;IACH,aAAa,IAAI,IAAI,CAAC;CACzB;AAMD;;;;;GAKG;AACH,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IAC/D;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,GAAG,CAAC;CAC9B;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,wBAAyB,SAAQ,sBAAsB;IACpE,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,mCAAmC;IACnC,SAAS,EAAE;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,CAAA;KAAE,CAAC;IACtD,4DAA4D;IAC5D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,kBAAkB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,qEAAqE;IACrE,mBAAmB,CAAC,EAAE,QAAQ,CAAC;IAC/B,kFAAkF;IAClF,wBAAwB,CAAC,EAAE,cAAc,CAAC;IAC1C;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CAC1C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibgib/web-gib",
3
- "version": "0.0.36",
3
+ "version": "0.0.42",
4
4
  "description": "Framework for creating agentic ibGib web apps. Contains plumbing for ibgib components, agentic framework (currently only Gemini implemented), web-based IndexedDB storage substrate, and more.",
5
5
  "funding": {
6
6
  "type": "individual",
@@ -11,31 +11,10 @@
11
11
  "web-gib-init-agents": "./tools/init-agents.js"
12
12
  },
13
13
  "scripts": {
14
- "clean": "node ../../node_modules/@ibgib/helper-gib/tools/clean.js ./dist",
15
- "generate:src:version": "node ./tools/generate-version-file.js",
16
- "generate:agent:skills": "node ./tools/copy-agent-skills.js",
17
- "prebuild": "npm run generate:src:version && npm run generate:agent:skills",
18
- "build": "npm run clean && tsc -b tsconfig.json --force",
19
- "build:test": "npm run clean && tsc -b tsconfig.test.json --force",
20
- "build:test:noclean": "tsc -b tsconfig.test.json --force",
21
- "test": "npm run test:both",
22
- "test:both": "npm run build:test && npm run test:node:nobuild && npm run test:browser:nobuild",
23
- "man:test:both": "use this if you want to test in both node and browser contexts",
24
- "pretest:node": "npm run build:test",
25
- "test:node": "node dist/respec-gib.node.mjs --inspect",
26
- "man:test:node": "use this if you want to build+test in node",
27
- "test:node:nobuild": "node dist/respec-gib.node.mjs --inspect",
28
- "man:test:node:nobuild": "use this if you want to test in node but its already built",
29
- "test:browser": "npm run build:test && echo \"not implemented yet\"",
30
- "man:test:browser": "use this if you want to build+test only the browser context",
31
- "test:browser:nobuild": "echo \"not implemented yet\"",
32
- "man:test:browser:nobuild": "use this if you want to test only the browser context but its already built",
33
- "test:browser:serve": "npm run build:test && echo \"not implemented yet\"",
34
- "man:test:browser:serve": "use this if you want to build+test in the browser and don't want the browser to close when your done. (i.e. you're debugging)",
35
- "test:browser:serve:nobuild": "\"not implemented yet\"",
36
- "man:test:browser:serve:nobuild": "use this if you are troubleshooting existing dist output and don't want to overwrite those files. (and you're debugging in the browser)",
14
+ "//_orchestration": "~~ ORCHESTRATION (handled by @ibgib/build-gib) ~~",
15
+ "//_publish": "~~ PUBLISH ~~",
37
16
  "pack": "npm pack --pack-destination=\"./published\"",
38
- "prepare:publish": "npm run clean && npm version patch && npm run build && npm run pack",
17
+ "prepare:publish": "npm version patch && node ../../build/dist/concrete-build/build-web-gib.mjs --prod && npm run pack",
39
18
  "man:prepare:publish": "use this to patch > build > pack for publishing to npm repo"
40
19
  },
41
20
  "type": "module",
@@ -49,10 +28,10 @@
49
28
  "license": "ISC",
50
29
  "dependencies": {
51
30
  "@google/genai": "^1.33.0",
52
- "@ibgib/core-gib": "^0.1.54",
53
- "@ibgib/encrypt-gib": "^0.2.37",
54
- "@ibgib/helper-gib": "^0.0.36",
55
- "@ibgib/ts-gib": "^0.5.32"
31
+ "@ibgib/core-gib": "*",
32
+ "@ibgib/encrypt-gib": "*",
33
+ "@ibgib/helper-gib": "*",
34
+ "@ibgib/ts-gib": "*"
56
35
  },
57
36
  "engines": {
58
37
  "node": ">=19.0.0"
@@ -11,4 +11,4 @@
11
11
  /**
12
12
  * this is the version of this package, auto-updated in the build process
13
13
  */
14
- export const AUTO_GENERATED_VERSION = '0.0.36';
14
+ export const AUTO_GENERATED_VERSION = '0.0.42';
@@ -122,6 +122,26 @@ export interface IbGibIdentityContext {
122
122
  data?: Record<string, any>;
123
123
  }
124
124
 
125
+ // ---------------------------------------------------------------------------
126
+ // UI Shell
127
+ // ---------------------------------------------------------------------------
128
+
129
+ /**
130
+ * Minimal interface for an application's UI Shell.
131
+ *
132
+ * ## design notes
133
+ *
134
+ * This is intentionally minimal to avoid coupling the bootstrap engine to a
135
+ * specific UI design (header, panels, etc.).
136
+ */
137
+ export interface IbGibAppShell {
138
+ /**
139
+ * Hook called by the bootstrap engine when the ibGib engine and metaspace
140
+ * are fully initialized and ready for interaction.
141
+ */
142
+ onEngineReady(): void;
143
+ }
144
+
125
145
  // ---------------------------------------------------------------------------
126
146
  // GlobalThis layers
127
147
  // ---------------------------------------------------------------------------
@@ -163,6 +183,11 @@ export interface IbGibGlobalThis_Common extends IbGibGlobalThisInfo {
163
183
  export interface IbGibGlobalThis_IbGibApp extends IbGibGlobalThis_Common {
164
184
  /** Semver string generated at build time. */
165
185
  version?: string;
186
+ /**
187
+ * The application's UI Shell service.
188
+ * Initialized by the consumer and registered on the globalThis.
189
+ */
190
+ shell?: IbGibAppShell;
166
191
  /** Per-space RCLI pathing shim. */
167
192
  spaceShim: { [spaceId: string]: SpaceShimGlobalInfo };
168
193
  /** When true, verbose output is enabled for the session. */
@@ -2,9 +2,9 @@
2
2
  name: ibgib-create-app-core
3
3
  description: >
4
4
  Scaffolds the foundational ibgib bootstrap flow and global state management.
5
- Generates the 7 foundational files (index.html, index.mts, bootstrap.mts,
6
- constants.mts, types.mts, helpers.web.mts, and style.css) required for an
7
- ibgib app to boot. Supports both greenfield and brownfield projects.
5
+ Generates the 8 foundational files (index.html, index.mts, script.mts,
6
+ bootstrap.mts, constants.mts, types.mts, helpers.web.mts, and style.css)
7
+ required for an ibgib app to boot. Supports both greenfield and brownfield projects.
8
8
  ---
9
9
 
10
10
  # Skill: ibgib-create-app-core
@@ -62,13 +62,14 @@ Apply token substitutions to templates in `templates/` and write to the target d
62
62
 
63
63
  | Template file | Output file |
64
64
  |---|---|
65
- | `templates/index.html.template` | `index.html` |
66
- | `templates/index.mts.template` | `index.mts` |
67
- | `templates/bootstrap.mts.template` | `bootstrap.mts` |
68
- | `templates/constants.mts.template` | `constants.mts` |
69
- | `templates/types.mts.template` | `types.mts` |
70
- | `templates/helpers.web.mts.template` | `helpers.web.mts` |
71
- | `templates/style.css.template` | `style.css` (if missing) |
65
+ | templates/index.html.template | `index.html` |
66
+ | templates/index.mts.template | `index.mts` |
67
+ | templates/script.mts.template | `script.mts` |
68
+ | templates/bootstrap.mts.template | `bootstrap.mts` |
69
+ | templates/constants.mts.template | `constants.mts` |
70
+ | templates/types.mts.template | `types.mts` |
71
+ | templates/helpers.web.mts.template | `helpers.web.mts` |
72
+ | templates/style.css.template | `style.css` (if missing) |
72
73
 
73
74
  ### 3. Replace `genuuid` placeholders
74
75
 
@@ -12,6 +12,7 @@
12
12
  <meta name="ibgib-app-id" content="{{APP_UUID}}" />
13
13
  <title>{{APP_HUMAN_NAME}}</title>
14
14
  <link rel="stylesheet" type="text/css" href="style.css">
15
+ <script type="module" src="script.mjs" defer></script>
15
16
  <script type="module" src="index.mjs" defer></script>
16
17
  </head>
17
18
 
@@ -0,0 +1,17 @@
1
+ /**
2
+ * script.mts
3
+ *
4
+ * Early initialization script for the {{APP_HUMAN_NAME}} app.
5
+ *
6
+ * This script is intended to run as soon as the HTML document is parsed,
7
+ * allowing UI Shell logic (like menus and panels) to be interactive
8
+ * immediately, without waiting for the heavier ibgib engine bootstrap.
9
+ */
10
+
11
+ // import { get{{APP_CLASSNAME_PREFIX}}ShellSvc } from "./ui/shell/{{APP_DIR_NAME}}-shell-service.mjs";
12
+
13
+ // Early init of UI Shell logic so the burger menu responds immediately.
14
+ // Modules execute after the HTML document has been parsed, so elements are ready.
15
+ // get{{APP_CLASSNAME_PREFIX}}ShellSvc();
16
+
17
+ console.log('{{APP_HUMAN_NAME}} early script executing...');
@@ -24,11 +24,17 @@ The skill will generate:
24
24
  1. `src/ui/shell/{{APP_DIR_NAME}}-shell-service.mts`
25
25
  2. `src/ui/shell/{{APP_DIR_NAME}}-shell-constants.mts`
26
26
  3. `src/ui/shell/{{APP_DIR_NAME}}-shell-types.mts`
27
+ 4. `src/script.mts`
27
28
 
28
29
  ## Usage Instructions
29
30
  1. Ensure the `src/ui/shell` directory exists or the tool will create it.
30
- 2. Generate the three files from templates.
31
- 3. Update `src/bootstrap.mts` to import and call `get{{APP_CLASSNAME_PREFIX}}ShellSvc().onEngineReady()` in the `execFromArgs` function.
31
+ 2. Generate the shell service, constants, and types from templates.
32
+ 3. Update `src/script.mts` to import and call the shell factory:
33
+ ```typescript
34
+ import { get{{APP_CLASSNAME_PREFIX}}ShellSvc } from "./ui/shell/{{APP_DIR_NAME}}-shell-service.mjs";
35
+ get{{APP_CLASSNAME_PREFIX}}ShellSvc();
36
+ ```
37
+ 4. Update `src/bootstrap.mts` to import and call `get{{APP_CLASSNAME_PREFIX}}ShellSvc().onEngineReady()` in the `execFromArgs` function.
32
38
 
33
39
  ## Integration Note
34
40
  The shell service provides an `onEngineReady()` hook. This is where you should put logic to "activate" the UI once the ibgib metaspace and app witness are fully initialized.
@@ -1,309 +0,0 @@
1
- {
2
- // Place your ionic-gib workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
3
- // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
4
- // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
5
- // used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
6
- // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
7
- // Placeholders with the same ids are connected.
8
- // Example:
9
- // "Print to console": {
10
- // "scope": "javascript,typescript",
11
- // "prefix": "log",
12
- // "body": [
13
- // "console.log('$1');",
14
- // "$2"
15
- // ],
16
- // "description": "Log output to console"
17
- // }
18
- "this Fn lc try..catch rethrow": {
19
- "scope": "javascript,typescript",
20
- "prefix": "lc_trycatch_rethrow_this",
21
- "body": [
22
- "const lc = `\\${this.lc}[\\${this.$1.name}]`;",
23
- "try {",
24
- "\t$SELECTION$0",
25
- "} catch (error) {",
26
- "\tconsole.error(`\\${lc} \\${extractErrorMsg(error)}`);",
27
- "\tthrow error;",
28
- "}"
29
- ],
30
- },
31
- "this Fn lc try..catch..finally rethrow": {
32
- "scope": "javascript,typescript",
33
- "prefix": "lc_trycatchfinally_rethrow_this",
34
- "body": [
35
- "const lc = `\\${this.lc}[\\${this.$1.name}]`;",
36
- "try {",
37
- "\t$SELECTION$0",
38
- "} catch (error) {",
39
- "\tconsole.error(`\\${lc} \\${extractErrorMsg(error)}`);",
40
- "\tthrow error;",
41
- "} finally {",
42
- "\t$2",
43
- "}"
44
- ],
45
- },
46
- "this Fn lc try..catch..finally rethrow with logging": {
47
- "scope": "javascript,typescript",
48
- "prefix": "lc_trycatchfinally_rethrow_withlogging_this",
49
- "body": [
50
- "const lc = `\\${this.lc}[\\${this.$1.name}]`;",
51
- "try {",
52
- "\tif (logalot) { console.log(`\\${lc} starting... (I: $RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$CURRENT_YEAR_SHORT)`); }",
53
- "\t$SELECTION$0",
54
- "} catch (error) {",
55
- "\tconsole.error(`\\${lc} \\${extractErrorMsg(error)}`);",
56
- "\tthrow error;",
57
- "} finally {",
58
- "\tif (logalot) { console.log(`\\${lc} complete.`); }",
59
- "}"
60
- ],
61
- },
62
- "this Fn func async lc try..catch rethrow": {
63
- "scope": "javascript,typescript",
64
- "prefix": "this_func_lc_trycatch_rethrow_this",
65
- "body": [
66
- "${1:async function} ${2:fnName}({",
67
- "\t$3,",
68
- "}: {",
69
- "\t$3: $4,",
70
- "}): Promise<$5> {",
71
- "\tconst lc = `\\${this.lc}[\\${this.$2.name}]`;",
72
- "\ttry {",
73
- "\t\t$SELECTION$0",
74
- "\t} catch (error) {",
75
- "\t\tconsole.error(`\\${lc} \\${extractErrorMsg(error)}`);",
76
- "\t\tthrow error;",
77
- "\t}",
78
- "}"
79
- ],
80
- },
81
- "this Fn func async lc try..catch..finally rethrow": {
82
- "scope": "javascript,typescript",
83
- "prefix": "this_func_lc_trycatchfinally_rethrow_this",
84
- "body": [
85
- "${1:async function} ${2:fnName}({",
86
- "\t$3,",
87
- "}: {",
88
- "\t$3: $4,",
89
- "}): Promise<$5> {",
90
- "\tconst lc = `\\${this.lc}[\\${this.$2.name}]`;",
91
- "\ttry {",
92
- "\t\t$SELECTION$0",
93
- "\t} catch (error) {",
94
- "\t\tconsole.error(`\\${lc} \\${extractErrorMsg(error)}`);",
95
- "\t\tthrow error;",
96
- "\t} finally {",
97
- "\t\t$6",
98
- "\t}",
99
- "}"
100
- ],
101
- },
102
- "this Fn func async lc try..catch..finally rethrow with logging": {
103
- "scope": "javascript,typescript",
104
- "prefix": "this_func_lc_trycatchfinally_rethrow_withlogging_this",
105
- "body": [
106
- "${1:async function} ${2:fnName}({",
107
- "\t$3,",
108
- "}: {",
109
- "\t$3: $4,",
110
- "}): Promise<$5> {",
111
- "\tconst lc = `\\${this.lc}[\\${this.$2.name}]`;",
112
- "\ttry {",
113
- "\t\tif (logalot) { console.log(`\\${lc} starting... (I: $RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$CURRENT_YEAR_SHORT)`); }",
114
- "\t\t$SELECTION$0",
115
- "\t} catch (error) {",
116
- "\t\tconsole.error(`\\${lc} \\${extractErrorMsg(error)}`);",
117
- "\t\tthrow error;",
118
- "\t} finally {",
119
- "\t\tif (logalot) { console.log(`\\${lc} complete.`); }",
120
- "\t}",
121
- "}"
122
- ],
123
- },
124
- "Fn lc try..catch rethrow": {
125
- "scope": "javascript,typescript",
126
- "prefix": "lc_trycatch_rethrow",
127
- "body": [
128
- "const lc = `[\\${$1.name}]`;",
129
- "try {",
130
- "\t$SELECTION$0",
131
- "} catch (error) {",
132
- "\tconsole.error(`\\${lc} \\${extractErrorMsg(error)}`);",
133
- "\tthrow error;",
134
- "}"
135
- ],
136
- },
137
- "Fn lc try..catch..finally rethrow": {
138
- "scope": "javascript,typescript",
139
- "prefix": "lc_trycatchfinally_rethrow",
140
- "body": [
141
- "const lc = `[\\${$1.name}]`;",
142
- "try {",
143
- "\t$SELECTION$0",
144
- "} catch (error) {",
145
- "\tconsole.error(`\\${lc} \\${extractErrorMsg(error)}`);",
146
- "\tthrow error;",
147
- "} finally {",
148
- "\t$2",
149
- "}"
150
- ],
151
- },
152
- "Fn lc try..catch..finally rethrow with logging": {
153
- "scope": "javascript,typescript",
154
- "prefix": "lc_trycatchfinally_rethrow_withlogging",
155
- "body": [
156
- "const lc = `[\\${$1.name}]`;",
157
- "try {",
158
- "\tif (logalot) { console.log(`\\${lc} starting... (I: $RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$CURRENT_YEAR_SHORT)`); }",
159
- "\t$SELECTION$0",
160
- "} catch (error) {",
161
- "\tconsole.error(`\\${lc} \\${extractErrorMsg(error)}`);",
162
- "\tthrow error;",
163
- "} finally {",
164
- "\tif (logalot) { console.log(`\\${lc} complete.`); }",
165
- "}"
166
- ],
167
- },
168
- "Fn func async lc try..catch rethrow": {
169
- "scope": "javascript,typescript",
170
- "prefix": "func_lc_trycatch_rethrow",
171
- "body": [
172
- "${1:export async function} ${2:fnName}({",
173
- "\t$3,",
174
- "}: {",
175
- "\t$3: $4,",
176
- "}): Promise<$5> {",
177
- "\tconst lc = `[\\${$2.name}]`;",
178
- "\ttry {",
179
- "\t\t$SELECTION$0",
180
- "\t} catch (error) {",
181
- "\t\tconsole.error(`\\${lc} \\${extractErrorMsg(error)}`);",
182
- "\t\tthrow error;",
183
- "\t}",
184
- "}"
185
- ],
186
- },
187
- "Fn func async lc try..catch..finally rethrow": {
188
- "scope": "javascript,typescript",
189
- "prefix": "func_lc_trycatchfinally_rethrow",
190
- "body": [
191
- "${1:export async function} ${2:fnName}({",
192
- "\t$3,",
193
- "}: {",
194
- "\t$3: $4,",
195
- "}): Promise<$5> {",
196
- "\tconst lc = `[\\${$2.name}]`;",
197
- "\ttry {",
198
- "\t\t$SELECTION$0",
199
- "\t} catch (error) {",
200
- "\t\tconsole.error(`\\${lc} \\${extractErrorMsg(error)}`);",
201
- "\t\tthrow error;",
202
- "\t} finally {",
203
- "\t\t$6",
204
- "\t}",
205
- "}"
206
- ],
207
- },
208
- "Fn func async lc try..catch..finally rethrow with logging": {
209
- "scope": "javascript,typescript",
210
- "prefix": "func_lc_trycatchfinally_rethrow_withlogging",
211
- "body": [
212
- "${1:export async function} ${2:fnName}({",
213
- "\t$3,",
214
- "}: {",
215
- "\t$3: $4,",
216
- "}): Promise<$5> {",
217
- "\tconst lc = `[\\${$2.name}]`;",
218
- "\ttry {",
219
- "\t\tif (logalot) { console.log(`\\${lc} starting... (I: $RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$CURRENT_YEAR_SHORT)`); }",
220
- "\t\t$SELECTION$0",
221
- "\t} catch (error) {",
222
- "\t\tconsole.error(`\\${lc} \\${extractErrorMsg(error)}`);",
223
- "\t\tthrow error;",
224
- "\t} finally {",
225
- "\t\tif (logalot) { console.log(`\\${lc} complete.`); }",
226
- "\t}",
227
- "}"
228
- ],
229
- },
230
- "throw new error with guid": {
231
- "scope": "javascript,typescript",
232
- "prefix": "throw_new_error_with_guid",
233
- "body": [
234
- "$0throw new Error(`$1 (E: $RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$CURRENT_YEAR_SHORT)`); "
235
- ],
236
- },
237
- "throw new error with guid (UNEXPECTED)": {
238
- "scope": "javascript,typescript",
239
- "prefix": "throw_new_error_with_guid_unexpected",
240
- "body": [
241
- "$0throw new Error(`(UNEXPECTED) $1? (E: $RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$CURRENT_YEAR_SHORT)`); "
242
- ],
243
- },
244
- "throw new error with guid not implemented": {
245
- "scope": "javascript,typescript",
246
- "prefix": "throw_new_error_with_guid_not_impl",
247
- "body": [
248
- "$0throw new Error(`not implemented (E: $RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$CURRENT_YEAR_SHORT)`); "
249
- ],
250
- },
251
- "if..throw with guid": {
252
- "scope": "javascript,typescript",
253
- "prefix": "if_throw_with_guid",
254
- "body": [
255
- "$0if ($1) { throw new Error(`$2 (E: $RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$CURRENT_YEAR_SHORT)`); }"
256
- ],
257
- },
258
- "if logalot log": {
259
- "scope": "javascript,typescript",
260
- "prefix": "if_logalot_log",
261
- "body": [
262
- "$0if (logalot$1) { console.${2:log}(`\\${lc} $3 (I: $RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$CURRENT_YEAR_SHORT)`); }"
263
- ],
264
- },
265
- "surround log if logalot log": {
266
- "scope": "javascript,typescript",
267
- "prefix": "surround_log_if_logalot",
268
- "body": [
269
- "if (logalot) { $SELECTION }"
270
- ],
271
- },
272
- "surround if logalot timer console time-timeEnd": {
273
- "scope": "javascript,typescript",
274
- "prefix": "surround_if_logalot_timer_console_time_timeend",
275
- "body": [
276
- "let timerName: string;",
277
- "const timerEnabled = true",
278
- "if (logalot && timerEnabled) {",
279
- "\ttimerName = lc.substring(0, ${1:24}) + '[timer $RANDOM_HEX]';",
280
- "\tconsole.log(`\\${timerName} starting... (I: $RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$RANDOM_HEX$CURRENT_YEAR_SHORT)`);",
281
- "\tconsole.time(timerName);",
282
- "}",
283
- "// can intersperse with calls to console.timeLog for intermediate times",
284
- "// if (logalot) { console.timeLog(timerName); }",
285
- "",
286
- "$0$SELECTION",
287
- "",
288
- "if (logalot && timerEnabled) {",
289
- "\tconsole.timeEnd(timerName);",
290
- "\tconsole.log(`\\${timerName} complete.`);",
291
- "}",
292
- ],
293
- },
294
- "if logalot global ibgib timer": {
295
- "scope": "javascript,typescript",
296
- "prefix": "if_logalot_ibgib_timer",
297
- "body": [
298
- "if (logalot) { console.log(`\\${lc}\\${c.GLOBAL_TIMER_NAME}`); console.timeLog(c.GLOBAL_TIMER_NAME); }$0"
299
- ],
300
- },
301
- "return early": {
302
- "scope": "javascript,typescript",
303
- "prefix": "return_early",
304
- "description": "I like to indicate returning early in a function in a comment, so it's more obvious in the editor if I'm scanning for comments.",
305
- "body": [
306
- "return$1; /* <<<< returns early */$0",
307
- ],
308
- },
309
- }
@@ -1,25 +0,0 @@
1
- {
2
- // Use IntelliSense to learn about possible attributes.
3
- // Hover to view descriptions of existing attributes.
4
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
- "version": "0.2.0",
6
- "configurations": [
7
- {
8
- "type": "node",
9
- "request": "launch",
10
- "name": "npm debug",
11
- "runtimeExecutable": "npm",
12
- "runtimeArgs": [
13
- "run",
14
- "debug",
15
- ],
16
- "port": 9229,
17
- "sourceMaps": true,
18
- "skipFiles": [
19
- "<node_internals>/**"
20
- ]
21
- },
22
-
23
- ]
24
- }filename
25
- filename
@@ -1,68 +0,0 @@
1
- {
2
- "typescript.tsdk": "node_modules/typescript/lib",
3
- "search.exclude": {
4
- "**/*.BAK": true,
5
- "**/*.bak": true,
6
- "**/dist": true
7
- },
8
- "files.watcherExclude": {
9
- "**/*.BAK": true,
10
- "**/*.bak": true
11
- },
12
- "editor.formatOnSave": true,
13
- "files.insertFinalNewline": true,
14
- "files.trimTrailingWhitespace": true,
15
- "files.trimFinalNewlines": true,
16
- "workbench.colorTheme": "Kimbie Dark",
17
- "workbench.colorCustomizations": {
18
- "editor.background": "#3e033e",
19
- "sideBar.background": "#3e0333",
20
- "editor.lineHighlightBackground": "#00ffb718",
21
- "activityBar.activeBackground": "#cc3636",
22
- "activityBar.background": "#cc3636",
23
- "activityBar.foreground": "#e7e7e7",
24
- "activityBar.inactiveForeground": "#e7e7e799",
25
- "activityBarBadge.background": "#134c13",
26
- "activityBarBadge.foreground": "#e7e7e7",
27
- "commandCenter.border": "#e7e7e799",
28
- "sash.hoverBorder": "#cc3636",
29
- "statusBar.background": "#a52a2a",
30
- "statusBar.foreground": "#e7e7e7",
31
- "statusBarItem.hoverBackground": "#cc3636",
32
- "statusBarItem.remoteBackground": "#a52a2a",
33
- "statusBarItem.remoteForeground": "#e7e7e7",
34
- "titleBar.activeBackground": "#a52a2a",
35
- "titleBar.activeForeground": "#e7e7e7",
36
- "titleBar.inactiveBackground": "#a52a2a99",
37
- "titleBar.inactiveForeground": "#e7e7e799"
38
- },
39
- "editor.tokenColorCustomizations": {
40
- "[Kimbie Dark]": {
41
- "variables": "#3e8a17",
42
- "comments": "#598cdf8c",
43
- "textMateRules": [
44
- {
45
- "name": "Lists",
46
- "scope": "markup.list",
47
- "settings": {
48
- "foreground": "#cb76d6"
49
- }
50
- },
51
- {
52
- "scope": "entity.name.tag",
53
- "settings": {
54
- "foreground": "#6cb548"
55
- }
56
- },
57
- {
58
- "scope": "string",
59
- "settings": {
60
- "foreground": "#84cad3"
61
- }
62
- }
63
- ],
64
- }
65
- },
66
- "peacock.color": "brown",
67
- "insertGuid.pasteAutomatically": "{n}",
68
- }
@@ -1,38 +0,0 @@
1
- {
2
- // See https://go.microsoft.com/fwlink/?LinkId=733558
3
- // for the documentation about the tasks.json format
4
- "version": "2.0.0",
5
- "tasks": [
6
- {
7
- "type": "npm",
8
- "script": "build",
9
- "group": "build",
10
- "problemMatcher": []
11
- },
12
- {
13
- "type": "npm",
14
- "script": "test",
15
- "group": "build",
16
- "problemMatcher": []
17
- },
18
- {
19
- "type": "npm",
20
- "script": "clean",
21
- "group": "build",
22
- "problemMatcher": []
23
- },
24
- {
25
- "type": "npm",
26
- "script": "build:test",
27
- "group": "build",
28
- "problemMatcher": []
29
- },
30
- {
31
- "type": "npm",
32
- "script": "prepare:publish",
33
- "group": "build",
34
- "problemMatcher": []
35
- }
36
- ],
37
- }filename
38
- filename