|
14 | 14 | {...$$restProps}><slot /></svelte:component
|
15 | 15 | >
|
16 | 16 |
|
17 |
| -<script lang="ts" context="module"> |
18 |
| - import type { ClassAdderInternals } from './ClassAdder.types.js'; |
19 |
| - import { SmuiElement } from '../index.js'; |
20 |
| -
|
21 |
| - export const internals: ClassAdderInternals = { |
22 |
| - component: SmuiElement as typeof SvelteComponent, |
23 |
| - tag: 'div', |
24 |
| - class: '', |
25 |
| - classMap: {}, |
26 |
| - contexts: {}, |
27 |
| - props: {}, |
28 |
| - }; |
29 |
| -</script> |
30 |
| - |
31 | 17 | <script lang="ts">
|
32 | 18 | import type { SvelteComponent } from 'svelte';
|
33 | 19 | import { onDestroy, getContext, setContext } from 'svelte';
|
|
39 | 25 | } from '../smui.types.js';
|
40 | 26 | import type { ActionArray } from '../internal/useActions.js';
|
41 | 27 | import { classMap } from '../internal/classMap.js';
|
| 28 | + import { SmuiElement } from '../index.js'; |
| 29 | + import type { ClassAdderInternals } from './ClassAdder.types.js'; |
42 | 30 |
|
43 | 31 | type OwnProps = {
|
44 | 32 | use?: ActionArray;
|
|
55 | 43 | export let use: ActionArray = [];
|
56 | 44 | let className = '';
|
57 | 45 | export { className as class };
|
| 46 | + export let _internals: ClassAdderInternals = { |
| 47 | + component: SmuiElement as typeof SvelteComponent, |
| 48 | + tag: 'div', |
| 49 | + class: '', |
| 50 | + classMap: {}, |
| 51 | + contexts: {}, |
| 52 | + props: {}, |
| 53 | + }; |
58 | 54 |
|
59 | 55 | let element: SvelteComponent;
|
60 |
| - const smuiClass = internals.class; |
| 56 | + const smuiClass = _internals.class; |
61 | 57 | const smuiClassMap: { [k: string]: any } = {};
|
62 | 58 | const smuiClassUnsubscribes: (() => void)[] = [];
|
63 |
| - const contexts = internals.contexts; |
64 |
| - const props = internals.props; |
| 59 | + const contexts = _internals.contexts; |
| 60 | + const props = _internals.props; |
65 | 61 |
|
66 | 62 | export let component: typeof SvelteComponent<
|
67 | 63 | Record<string, any>,
|
68 | 64 | Record<string, any>,
|
69 | 65 | Record<string, any>
|
70 |
| - > = internals.component; |
| 66 | + > = _internals.component; |
71 | 67 | export let tag: keyof SmuiElementPropMap | undefined =
|
72 |
| - component === SmuiElement ? internals.tag : undefined; |
| 68 | + component === SmuiElement ? _internals.tag : undefined; |
73 | 69 |
|
74 |
| - Object.entries(internals.classMap).forEach(([name, context]) => { |
| 70 | + Object.entries(_internals.classMap).forEach(([name, context]) => { |
75 | 71 | const store = getContext(context) as SvelteStore<any>;
|
76 | 72 |
|
77 | 73 | if (store && 'subscribe' in store) {
|
|
0 commit comments