@rool-dev/extension 0.3.8-dev.009f6e4 → 0.3.8-dev.8872f4d
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { onMount, tick } from 'svelte';
|
|
2
|
+
import { getContext, onMount, tick } from 'svelte';
|
|
3
3
|
import { DevHostController } from './DevHostController.js';
|
|
4
4
|
import type { ExtensionTab } from './DevHostController.js';
|
|
5
5
|
import type { Manifest } from '../manifest.js';
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
import Sidebar from './Sidebar.svelte';
|
|
9
9
|
import AppGrid from './AppGrid.svelte';
|
|
10
10
|
|
|
11
|
-
//
|
|
12
|
-
interface
|
|
11
|
+
// Static config injected via mount() context — not reactive, never changes
|
|
12
|
+
interface HostConfig {
|
|
13
13
|
channelId: string;
|
|
14
14
|
extensionUrl: string;
|
|
15
15
|
manifest: Manifest | null;
|
|
16
16
|
manifestError: string | null;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const
|
|
19
|
+
const { channelId, extensionUrl, manifest, manifestError } = getContext<HostConfig>('hostConfig');
|
|
20
20
|
|
|
21
21
|
// ---------------------------------------------------------------------------
|
|
22
22
|
// Controller + reactive state mirror
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
let dropdownOpen: boolean = $state(false);
|
|
41
41
|
|
|
42
42
|
const controller = new DevHostController(
|
|
43
|
-
|
|
43
|
+
{ channelId, extensionUrl, manifest, manifestError },
|
|
44
44
|
syncState,
|
|
45
45
|
tick,
|
|
46
46
|
);
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
|
|
64
64
|
// Derived: published apps not yet installed (excluding the local dev app)
|
|
65
65
|
let uninstalledExtensions = $derived(
|
|
66
|
-
publishedExtensions.filter((ext) => ext.extensionId !==
|
|
66
|
+
publishedExtensions.filter((ext) => ext.extensionId !== channelId && !installedExtensionIds.includes(ext.extensionId)),
|
|
67
67
|
);
|
|
68
68
|
|
|
69
69
|
// Initial sync
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
<!-- Sidebar -->
|
|
90
90
|
<Sidebar
|
|
91
91
|
{controller}
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
{manifest}
|
|
93
|
+
{manifestError}
|
|
94
94
|
{spaces}
|
|
95
95
|
{currentSpaceId}
|
|
96
96
|
{env}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
interface Props {
|
|
3
|
-
channelId: string;
|
|
4
|
-
extensionUrl: string;
|
|
5
|
-
manifest: Manifest | null;
|
|
6
|
-
manifestError: string | null;
|
|
7
|
-
}
|
|
8
|
-
declare const HostShell: import("svelte").Component<Props, {}, "">;
|
|
1
|
+
declare const HostShell: import("svelte").Component<Record<string, never>, {}, "">;
|
|
9
2
|
type HostShell = ReturnType<typeof HostShell>;
|
|
10
3
|
export default HostShell;
|
|
11
4
|
//# sourceMappingURL=HostShell.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HostShell.svelte.d.ts","sourceRoot":"","sources":["../../src/dev/HostShell.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HostShell.svelte.d.ts","sourceRoot":"","sources":["../../src/dev/HostShell.svelte.ts"],"names":[],"mappings":"AAkHA,QAAA,MAAM,SAAS,2DAAwC,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}
|
package/dist/dev/host-shell.js
CHANGED
|
@@ -313,6 +313,19 @@ function set_component_context(context) {
|
|
|
313
313
|
component_context = context;
|
|
314
314
|
}
|
|
315
315
|
/**
|
|
316
|
+
* Retrieves the context that belongs to the closest parent component with the specified `key`.
|
|
317
|
+
* Must be called during component initialisation.
|
|
318
|
+
*
|
|
319
|
+
* [`createContext`](https://svelte.dev/docs/svelte/svelte#createContext) is a type-safe alternative.
|
|
320
|
+
*
|
|
321
|
+
* @template T
|
|
322
|
+
* @param {any} key
|
|
323
|
+
* @returns {T}
|
|
324
|
+
*/
|
|
325
|
+
function getContext(key) {
|
|
326
|
+
return get_or_init_context_map("getContext").get(key);
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
316
329
|
* @param {Record<string, unknown>} props
|
|
317
330
|
* @param {any} runes
|
|
318
331
|
* @param {Function} [fn]
|
|
@@ -355,6 +368,27 @@ function pop(component) {
|
|
|
355
368
|
function is_runes() {
|
|
356
369
|
return !legacy_mode_flag || component_context !== null && component_context.l === null;
|
|
357
370
|
}
|
|
371
|
+
/**
|
|
372
|
+
* @param {string} name
|
|
373
|
+
* @returns {Map<unknown, unknown>}
|
|
374
|
+
*/
|
|
375
|
+
function get_or_init_context_map(name) {
|
|
376
|
+
if (component_context === null) lifecycle_outside_component(name);
|
|
377
|
+
return component_context.c ??= new Map(get_parent_context(component_context) || void 0);
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* @param {ComponentContext} component_context
|
|
381
|
+
* @returns {Map<unknown, unknown> | null}
|
|
382
|
+
*/
|
|
383
|
+
function get_parent_context(component_context) {
|
|
384
|
+
let parent = component_context.p;
|
|
385
|
+
while (parent !== null) {
|
|
386
|
+
const context_map = parent.c;
|
|
387
|
+
if (context_map !== null) return context_map;
|
|
388
|
+
parent = parent.p;
|
|
389
|
+
}
|
|
390
|
+
return null;
|
|
391
|
+
}
|
|
358
392
|
//#endregion
|
|
359
393
|
//#region ../../node_modules/.pnpm/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/task.js
|
|
360
394
|
/** @type {Array<() => void>} */
|
|
@@ -4119,48 +4153,6 @@ function bind_this(element_or_component = {}, update, get_value, get_parts) {
|
|
|
4119
4153
|
//#region ../../node_modules/.pnpm/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/props.js
|
|
4120
4154
|
/** @import { Effect, Source } from './types.js' */
|
|
4121
4155
|
/**
|
|
4122
|
-
* The proxy handler for rest props (i.e. `const { x, ...rest } = $props()`).
|
|
4123
|
-
* Is passed the full `$$props` object and excludes the named props.
|
|
4124
|
-
* @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Array<string | symbol>, name?: string }>}}
|
|
4125
|
-
*/
|
|
4126
|
-
var rest_props_handler = {
|
|
4127
|
-
get(target, key) {
|
|
4128
|
-
if (target.exclude.includes(key)) return;
|
|
4129
|
-
return target.props[key];
|
|
4130
|
-
},
|
|
4131
|
-
set(target, key) {
|
|
4132
|
-
return false;
|
|
4133
|
-
},
|
|
4134
|
-
getOwnPropertyDescriptor(target, key) {
|
|
4135
|
-
if (target.exclude.includes(key)) return;
|
|
4136
|
-
if (key in target.props) return {
|
|
4137
|
-
enumerable: true,
|
|
4138
|
-
configurable: true,
|
|
4139
|
-
value: target.props[key]
|
|
4140
|
-
};
|
|
4141
|
-
},
|
|
4142
|
-
has(target, key) {
|
|
4143
|
-
if (target.exclude.includes(key)) return false;
|
|
4144
|
-
return key in target.props;
|
|
4145
|
-
},
|
|
4146
|
-
ownKeys(target) {
|
|
4147
|
-
return Reflect.ownKeys(target.props).filter((key) => !target.exclude.includes(key));
|
|
4148
|
-
}
|
|
4149
|
-
};
|
|
4150
|
-
/**
|
|
4151
|
-
* @param {Record<string, unknown>} props
|
|
4152
|
-
* @param {string[]} exclude
|
|
4153
|
-
* @param {string} [name]
|
|
4154
|
-
* @returns {Record<string, unknown>}
|
|
4155
|
-
*/
|
|
4156
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4157
|
-
function rest_props(props, exclude, name) {
|
|
4158
|
-
return new Proxy({
|
|
4159
|
-
props,
|
|
4160
|
-
exclude
|
|
4161
|
-
}, rest_props_handler);
|
|
4162
|
-
}
|
|
4163
|
-
/**
|
|
4164
4156
|
* This function is responsible for synchronizing a possibly bound prop with the inner component state.
|
|
4165
4157
|
* It is used whenever the compiler sees that the component writes to the prop, or when it has a default prop_value.
|
|
4166
4158
|
* @template V
|
|
@@ -15244,11 +15236,7 @@ var root_1 = /* @__PURE__ */ from_html(`<div class="flex items-center justify-ce
|
|
|
15244
15236
|
var root$1 = /* @__PURE__ */ from_html(`<!> <div class="flex-1 min-w-0 flex flex-col"><!></div>`, 1);
|
|
15245
15237
|
function HostShell($$anchor, $$props) {
|
|
15246
15238
|
push($$props, true);
|
|
15247
|
-
const
|
|
15248
|
-
"$$slots",
|
|
15249
|
-
"$$events",
|
|
15250
|
-
"$$legacy"
|
|
15251
|
-
]);
|
|
15239
|
+
const { channelId, extensionUrl, manifest, manifestError } = getContext("hostConfig");
|
|
15252
15240
|
let spaces = /* @__PURE__ */ state(proxy([]));
|
|
15253
15241
|
let currentSpaceId = /* @__PURE__ */ state(null);
|
|
15254
15242
|
let statusText = /* @__PURE__ */ state("Initializing...");
|
|
@@ -15263,7 +15251,12 @@ function HostShell($$anchor, $$props) {
|
|
|
15263
15251
|
let publishMessage = /* @__PURE__ */ state(null);
|
|
15264
15252
|
let publishUrl = /* @__PURE__ */ state(null);
|
|
15265
15253
|
let dropdownOpen = /* @__PURE__ */ state(false);
|
|
15266
|
-
const controller = new DevHostController(
|
|
15254
|
+
const controller = new DevHostController({
|
|
15255
|
+
channelId,
|
|
15256
|
+
extensionUrl,
|
|
15257
|
+
manifest,
|
|
15258
|
+
manifestError
|
|
15259
|
+
}, syncState, tick);
|
|
15267
15260
|
function syncState() {
|
|
15268
15261
|
set(spaces, controller.spaces, true);
|
|
15269
15262
|
set(currentSpaceId, controller.currentSpaceId, true);
|
|
@@ -15279,7 +15272,7 @@ function HostShell($$anchor, $$props) {
|
|
|
15279
15272
|
set(publishMessage, controller.publishMessage, true);
|
|
15280
15273
|
set(publishUrl, controller.publishUrl, true);
|
|
15281
15274
|
}
|
|
15282
|
-
let uninstalledExtensions = /* @__PURE__ */ user_derived(() => get(publishedExtensions).filter((ext) => ext.extensionId !==
|
|
15275
|
+
let uninstalledExtensions = /* @__PURE__ */ user_derived(() => get(publishedExtensions).filter((ext) => ext.extensionId !== channelId && !get(installedExtensionIds).includes(ext.extensionId)));
|
|
15283
15276
|
syncState();
|
|
15284
15277
|
onMount(() => {
|
|
15285
15278
|
controller.boot();
|
|
@@ -15296,10 +15289,10 @@ function HostShell($$anchor, $$props) {
|
|
|
15296
15289
|
return controller;
|
|
15297
15290
|
},
|
|
15298
15291
|
get manifest() {
|
|
15299
|
-
return
|
|
15292
|
+
return manifest;
|
|
15300
15293
|
},
|
|
15301
15294
|
get manifestError() {
|
|
15302
|
-
return
|
|
15295
|
+
return manifestError;
|
|
15303
15296
|
},
|
|
15304
15297
|
get spaces() {
|
|
15305
15298
|
return get(spaces);
|
|
@@ -15385,14 +15378,18 @@ var style = document.createElement("style");
|
|
|
15385
15378
|
style.textContent = app_default + "\n" + gridstack_default;
|
|
15386
15379
|
document.head.appendChild(style);
|
|
15387
15380
|
var root = document.getElementById("rool-host");
|
|
15381
|
+
var channelId = root.dataset.channelId ?? "extension-dev";
|
|
15382
|
+
var extensionUrl = root.dataset.extensionUrl ?? "/";
|
|
15383
|
+
var manifest = root.dataset.manifest ? JSON.parse(root.dataset.manifest) : null;
|
|
15384
|
+
var manifestError = root.dataset.manifestError ?? null;
|
|
15388
15385
|
mount(HostShell, {
|
|
15389
15386
|
target: root,
|
|
15390
|
-
|
|
15391
|
-
channelId
|
|
15392
|
-
extensionUrl
|
|
15393
|
-
manifest
|
|
15394
|
-
manifestError
|
|
15395
|
-
}
|
|
15387
|
+
context: new Map([["hostConfig", {
|
|
15388
|
+
channelId,
|
|
15389
|
+
extensionUrl,
|
|
15390
|
+
manifest,
|
|
15391
|
+
manifestError
|
|
15392
|
+
}]])
|
|
15396
15393
|
});
|
|
15397
15394
|
//#endregion
|
|
15398
15395
|
|