Skip to content

Commit

Permalink
Merge pull request #375 from NullVoxPopuli/upgrade-stuff-2
Browse files Browse the repository at this point in the history
progress towards getting `ember s` working again
  • Loading branch information
NullVoxPopuli authored Feb 14, 2022
2 parents 53322d0 + d5614cd commit 87f8d51
Show file tree
Hide file tree
Showing 84 changed files with 4,231 additions and 4,975 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# compiled output
dist/
/tmp/
/out/

# dependencies
/bower_components/
Expand All @@ -14,6 +15,7 @@ package-lock.json
.env*
.pnp*
.eslintcache
.turbo
npm-debug.log*
yarn-error.log

15 changes: 15 additions & 0 deletions frontend/app/components/external-link.gts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import FaIcon from '@fortawesome/ember-fontawesome/components/fa-icon';

<template>
<a
target="_blank"
rel="noreferrer noopener"
href="#"
class="flex gap-2 items-baseline focus:ring-4 focus:outline-none focus-visible:outline-none rounded-sm"
...attributes
>
<span>{{yield}}</span>

<FaIcon @icon="external-link-alt" />
</a>
</template>
11 changes: 0 additions & 11 deletions frontend/app/components/external-link.hbs

This file was deleted.

17 changes: 17 additions & 0 deletions frontend/app/components/limber/building.gts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import service from 'limber/helpers/service';

<template>
{{#let (service 'editor') as |editor|}}
{{#if editor.isCompiling}}
<div class="
absolute top-0 inset-x-0
bg-opacity-95 p-10 bg-gray-100 shadow
text-black text-2xl font-bold z-20
flex gap-4 items-center"
>
<div class="loader animate-spin h-6 w-6"></div>
<span>Building...</span>
</div>
{{/if}}
{{/let}}
</template>
14 changes: 0 additions & 14 deletions frontend/app/components/limber/building.hbs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import Component from '@glimmer/component';
import { setComponentTemplate } from '@ember/component';
import { on } from '@ember/modifier';
import { action } from '@ember/object';
import { hbs } from 'ember-cli-htmlbars';

import { toBlob, toPng } from 'html-to-image';

import Menu from './menu';

/**
* This component is injected via the markdown rendering
*/
class CopyMenu extends Component {
export default class CopyMenu extends Component {
@action
copyAsText(event: Event) {
let code = getSnippetElement(event);
Expand All @@ -22,11 +23,9 @@ class CopyMenu extends Component {

await withExtraStyles(code, () => toClipboard(code));
}
}

export default setComponentTemplate(
hbs`
<Limber::Menu class="absolute top-3 right-4 z-10" data-test-copy-menu>
<template>
<Menu class="absolute top-3 right-4 z-10" data-test-copy-menu>
<:trigger>
📋
</:trigger>
Expand All @@ -39,10 +38,10 @@ export default setComponentTemplate(
Copy as image
</Item>
</:options>
</Limber::Menu>
`,
CopyMenu
);
</Menu>
</template>
}


/*************************************************
*
Expand Down
50 changes: 50 additions & 0 deletions frontend/app/components/limber/demo-select.gts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { on } from '@ember/modifier';
import { fn } from '@ember/helper';
import { inject as service } from '@ember/service';
import { waitFor } from '@ember/test-waiters';

import FaIcon from '@fortawesome/ember-fontawesome/components/fa-icon';

import { getFromLabel, NAMES } from 'limber/snippets';
import Menu from './menu';

import type EditorService from 'limber/services/editor';

export default class DemoSelect extends Component {
@service declare editor: EditorService;

demos = NAMES;

@action
@waitFor
async select(demoName: string) {
let demo = await getFromLabel(demoName);

this.editor.updateDemo(demo);
}

<template>
<Menu data-test-demo-select ...attributes>
<:trigger as |menu|>
<span class="grid grid-flow-col gap-2 items-center">
Select demo
{{#if menu.isOpen}}
<FaIcon @icon="angle-up" class="min-w-3" />
{{else}}
<FaIcon @icon="angle-right" class="min-w-3" />
{{/if}}
</span>
</:trigger>

<:options as |Item|>
{{#each this.demos as |demoName|}}
<Item {{on 'click' (fn this.select demoName)}} data-test-demo>
{{demoName}}
</Item>
{{/each}}
</:options>
</Menu>
</template>
}
20 changes: 0 additions & 20 deletions frontend/app/components/limber/demo-select.hbs

This file was deleted.

22 changes: 0 additions & 22 deletions frontend/app/components/limber/demo-select.ts

This file was deleted.

79 changes: 79 additions & 0 deletions frontend/app/components/limber/editor-controls/index.gts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { fn } from '@ember/helper';
import { on } from '@ember/modifier'

import FaIcon from '@fortawesome/ember-fontawesome/components/fa-icon';

import State from './state';

import type { InterpreterFrom } from 'xstate';

type Send = InterpreterFrom<typeof State>['send'];

const container = (element: Element, send: Send) => {
send('CONTAINER_FOUND', { container: element as HTMLElement });

return () => send('CONTAINER_REMOVED');
};

const Button = <template>
<button
type='button'
class="
block select-none py-2 px-3 text-white text-xs
hover:bg-[#9b2918]
focus:ring-4 ring-inset focus:outline-none"
...attributes
>
{{yield}}
</button>
</template>;

const Controls = <template>
{{#if @needsControls}}
<div
class='
absolute top-0 right-0 z-[1] flex lg:grid
{{if @isMinimized
'bg-ember-black h-full content-start'
}}
'
>
<Button
title={{if @isMaximized 'Back to split view' 'Maximize Editor'}}
{{on 'click' (fn @send 'MAXIMIZE')}}
>
{{#if @isMaximized}}
<FaIcon @icon='columns' />
{{else}}
<FaIcon @icon="window-maximize" @prefix='far' />
{{/if}}
</Button>
<Button
title={{if @isMinimized 'Back to split view' 'Minimize Editor'}}
{{on 'click' (fn @send 'MINIMIZE')}}
>
{{#if @isMinimized}}
<FaIcon @icon='columns' />
{{else}}
<FaIcon @icon='window-minimize' @prefix='far' />
{{/if}}
</Button>
</div>
{{/if}}
</template>;

<template>
<State as |state send|>
{{yield
(component
Controls
isMinimized=(state.matches 'hasContainer.minimized')
isMaximized=(state.matches 'hasContainer.maximized')
needsControls=state.context.container
send=send
)
(modifier container send)
}}
</State>
</template>

Loading

0 comments on commit 87f8d51

Please sign in to comment.