Skip to content

Commit

Permalink
Remove unused Playwright files and update dependencies in Svelte package
Browse files Browse the repository at this point in the history
  • Loading branch information
1aron committed Jan 17, 2025
1 parent 9a76fd0 commit 2caf498
Show file tree
Hide file tree
Showing 8 changed files with 229 additions and 397 deletions.
2 changes: 2 additions & 0 deletions packages/runtime/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class RuntimeCSS extends MasterCSS {
this.container = this.root as RuntimeCSS['container']
this.host = (this.root as ShadowRoot).host
}
console.log(this.container)
runtimeCSSs.push(this)
}

Expand All @@ -36,6 +37,7 @@ export class RuntimeCSS extends MasterCSS {
*/
observe(options: MutationObserverInit = { subtree: true, childList: true }) {
if (this.observing) return this
console.log(this.root)
if (this.root.styleSheets)
for (const sheet of this.root.styleSheets) {
const { ownerNode } = sheet
Expand Down
40 changes: 0 additions & 40 deletions packages/svelte/e2e/runtime.test.ts

This file was deleted.

21 changes: 10 additions & 11 deletions packages/svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"prepublishOnly": "pnpm run package",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"e2e": "playwright test -c playwright-ct.config.ts",
"lint": "eslint"
},
"license": "MIT",
Expand Down Expand Up @@ -57,20 +56,20 @@
"@master/css-runtime": "workspace:^"
},
"devDependencies": {
"@eslint/compat": "^1.2.4",
"@eslint/compat": "^1.2.5",
"@master/css-server": "workspace:^",
"@playwright/experimental-ct-svelte": "^1.49.1",
"@playwright/test": "^1.49.1",
"@sveltejs/adapter-vercel": "^5.5.2",
"@sveltejs/kit": "^2.5.4",
"@sveltejs/package": "^2.3.0",
"@sveltejs/vite-plugin-svelte": "^3.0.2",
"@sveltejs/adapter-vercel": "^5.5.3",
"@sveltejs/kit": "^2.16.0",
"@sveltejs/package": "^2.3.7",
"@sveltejs/vite-plugin-svelte": "^5.0.3",
"publint": "^0.1.16",
"shared": "workspace:^",
"svelte": "^4.2.12",
"svelte-check": "^3.6.7",
"tslib": "^2.6.2",
"typescript": "^5.4.2",
"vite": "^5.1.6"
"svelte": "^5.19.0",
"svelte-check": "^4.1.4",
"tslib": "^2.8.1",
"typescript": "^5.7.3",
"vite": "^6.0.7"
}
}
53 changes: 0 additions & 53 deletions packages/svelte/playwright-ct.config.ts

This file was deleted.

12 changes: 0 additions & 12 deletions packages/svelte/playwright/index.html

This file was deleted.

2 changes: 0 additions & 2 deletions packages/svelte/playwright/index.ts

This file was deleted.

70 changes: 41 additions & 29 deletions packages/svelte/src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,40 +1,52 @@
<script lang="ts">
import { onMount } from 'svelte';
import { writable } from 'svelte/store'
import type { Config } from '@master/css'
import CSSRuntimeProvider from '../lib/CSSRuntimeProvider.svelte'
import type { Config } from "@master/css";
import CSSRuntimeProvider from "../lib/CSSRuntimeProvider.svelte";
let containerRef: HTMLDivElement
let shadowRoot: ShadowRoot
const config = writable<Config>({
let containerRef = $state<HTMLDivElement>();
let config = $state<Config>({
styles: {
btn: 'b:2|red'
btn: "b:2|red",
},
});
let root = $state<ShadowRoot | Document | undefined | null>();
let destroy = $state(false);
$effect(() => {
if (containerRef) {
containerRef.attachShadow({ mode: "open" });
} else {
root = null
}
})
const root = writable<ShadowRoot>()
const destroy = writable<boolean>(false)
onMount(() => {
shadowRoot = containerRef.attachShadow({ mode: 'open' });
const shadowContent = document.createElement('div');
shadowContent.className = 'f:1000'
shadowRoot.appendChild(shadowContent);
})
});
$effect(() => {
if (!destroy) {
const shadowContent = document.createElement("div");
shadowContent.innerHTML = "SHADOW CONTENT";
shadowContent.className = "fg:red-60";
containerRef?.shadowRoot?.appendChild(shadowContent);
}
});
</script>

{#if $destroy}
<button on:click={() => destroy.set(false)}>INIT</button>
{#if destroy}
<button onclick={() => (destroy = false)}>INIT</button>
{/if}

{#if !$destroy}
<CSSRuntimeProvider config={$config} root={$root}>
<button on:click={() => destroy.set(true)}>DESTROY</button>
<button id="config-btn" class="btn bg:blue-50" on:click={() => config.set({})}>CONFIG</button>
<button id="root-btn" on:click={() => root.set(shadowRoot)}>ROOT</button>
{#if !destroy}
<CSSRuntimeProvider {config} {root}>
<button onclick={() => (destroy = true)}>DESTROY</button>
<button
id="config-btn"
class="btn bg:blue-50"
onclick={() => (config = {})}>CONFIG</button
>
<button
id="root-btn"
onclick={() => {
root = containerRef?.shadowRoot;
}}>ROOT</button
>
<div bind:this={containerRef}></div>
</CSSRuntimeProvider>
{/if}


Loading

0 comments on commit 2caf498

Please sign in to comment.