Skip to content

Commit

Permalink
Merge branch 'release/v0.14.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
betterthanclay committed Oct 3, 2019
2 parents 8b643fc + 046b392 commit 097d218
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 41 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v0.14.3 (2019-10-03)
* Updated text and definition rendering

## v0.14.2 (2019-10-02)
* Updated errorPageRenderer logic
* Make exception info section visible
Expand Down
4 changes: 1 addition & 3 deletions src/Glitch/Dumper/Inspect/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ class Curl
*/
public static function inspectCurl($resource, Entity $entity, Inspector $inspector): void
{
foreach (curl_getinfo($resource) as $key => $value) {
$entity->setMeta($key, $inspector->inspectValue($value));
}
$entity->setMetaList($inspector->inspectList(curl_getinfo($resource)));
}
}
8 changes: 4 additions & 4 deletions src/Glitch/Dumper/Inspect/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ public static function inspectDateTime(\DateTime $date, Entity $entity, Inspecto

$entity
->setText($date->format('H:i:s jS M Y T'))
->setMeta('w3c', $date->format($date::W3C))
->setMeta('timezone', $date->format('e'))
->setMeta('utc', $date->format('P'))
->setMeta('fromNow', self::formatInterval($fromNow))
->setMeta('w3c', $inspector($date->format($date::W3C)))
->setMeta('timezone', $inspector($date->format('e')))
->setMeta('utc', $inspector($date->format('P')))
->setMeta('fromNow', $inspector(self::formatInterval($fromNow)))
;
}

Expand Down
4 changes: 1 addition & 3 deletions src/Glitch/Dumper/Inspect/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ class Process
*/
public static function inspectProcess($resource, Entity $entity, Inspector $inspector): void
{
foreach (proc_get_status($resource) as $key => $value) {
$entity->setMeta($key, $inspector->inspectValue($value));
}
$entity->setMetaList($inspector->inspectList(proc_get_status($resource)));
}
}
9 changes: 2 additions & 7 deletions src/Glitch/Dumper/Inspect/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ class Stream
*/
public static function inspectStream($resource, Entity $entity, Inspector $inspector): void
{
foreach (stream_get_meta_data($resource) as $key => $value) {
$entity->setMeta($key, $inspector->inspectValue($value));
}

$entity->setMetaList($inspector->inspectList(stream_get_meta_data($resource)));
self::inspectStreamContext($resource, $entity, $inspector);
}

Expand All @@ -32,8 +29,6 @@ public static function inspectStreamContext($resource, Entity $entity, Inspector
return;
}

foreach ($params as $key => $value) {
$entity->setMeta($key, $inspector->inspectValue($value));
}
$entity->setMetaList($inspector->inspectList($params));
}
}
14 changes: 6 additions & 8 deletions src/Glitch/Renderer/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,10 @@ protected function renderString(string $string, ?string $class=null, int $forceS
{
$isMultiLine = $forceSingleLineMax === null && false !== strpos($string, "\n");

if ($class !== null) {
return $this->renderIdentifierString($string, $class, $forceSingleLineMax);
} elseif ($isMultiLine) {
return $this->renderMultiLineString($string);
if ($isMultiLine) {
return $this->renderMultiLineString($string, $class);
} else {
return $this->renderSingleLineString($string, $forceSingleLineMax);
return $this->renderSingleLineString($string, $class, $forceSingleLineMax);
}
}

Expand All @@ -389,7 +387,7 @@ protected function renderMultiLineString(string $string, string $class=null): st
/**
* Passthrough string
*/
protected function renderSingleLineString(string $string, int $forceSingleLineMax=null): string
protected function renderSingleLineString(string $string, string $class=null, int $forceSingleLineMax=null): string
{
return $string;
}
Expand Down Expand Up @@ -618,7 +616,7 @@ protected function renderStackFrameSignature(Frame $frame): string
$function[] = $this->renderGrammar('{');

foreach ($parts as $part) {
$fArgs[] = $this->renderString($part, 'identifier');
$fArgs[] = $this->renderIdentifierString($part, 'identifier');
}

$function[] = implode($this->renderGrammar(',').' ', $fArgs);
Expand Down Expand Up @@ -1318,7 +1316,7 @@ protected function renderDefinitionBlock(Entity $entity, int $level=0, bool $ope
$type = $entity->getType();

$output = $this->indent(
$this->renderMultiLineString($entity->getDefinition(), 'def')
$this->renderScalar($entity->getDefinition(), 'def')
);

return $this->wrapEntityBodyBlock($output, 'def', true, $id, $type);
Expand Down
2 changes: 1 addition & 1 deletion src/Glitch/Renderer/Cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ protected function renderMultiLineString(string $string, string $class=null): st
/**
* Render a standard single line string
*/
protected function renderSingleLineString(string $string, int $forceSingleLineMax=null): string
protected function renderSingleLineString(string $string, string $class=null, int $forceSingleLineMax=null): string
{
$output = $this->format('"', 'white', null, 'dim');
$output .= $this->stackFormat('red', null, 'bold');
Expand Down
4 changes: 2 additions & 2 deletions src/Glitch/Renderer/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -627,9 +627,9 @@ protected function renderMultiLineString(string $string, string $class=null): st
/**
* Render a standard single line string
*/
protected function renderSingleLineString(string $string, int $forceSingleLineMax=null): string
protected function renderSingleLineString(string $string, string $class=null, int $forceSingleLineMax=null): string
{
$output = '<span class="string s"><span class="line">'.$this->renderStringLine($string, $forceSingleLineMax).'</span>';
$output = '<span class="string s '.$class.'"><span class="line">'.$this->renderStringLine($string, $forceSingleLineMax).'</span>';

if ($forceSingleLineMax === null) {
$output .= '<span class="length">'.mb_strlen($string).'</span>';
Expand Down
2 changes: 1 addition & 1 deletion src/Glitch/Renderer/assets/glitch.css

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/Glitch/Renderer/assets/scss/_colours.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
--list-meta: #F76F7B;
--list-meta-icon: #FA97A0;
--list-meta-key: var(--list-key);
--list-text-icon: #F76F7B;
--list-definition-icon: #FED2AC;
--list-property-icon-public: #35CE57;
--list-property-icon-protected: #FED453;
--list-property-icon-private: #FBAFB6;
Expand Down
38 changes: 35 additions & 3 deletions src/Glitch/Renderer/assets/scss/_entity.scss
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,48 @@ div.entity {
opacity: 0.5;
position: relative;
margin-top: 0.3em;
font-size: 0.8em;
font-size: 0.9em;
font-weight: bold;
}


&.t-text > div.binary {
i {
&.t-text {
> div.binary i {
margin-right: 0.5em;
color: var(--binary);
}

> div.text {
&:before {
content: '';
color: var(--list-text-icon);
position: relative;
margin-top: 0.3em;
font-size: 0.9em;
font-weight: bold;
}

> .string.m > .line {
border-left: 1rem solid rgba($red-bright, 0.06);
}
}
}

&.t-def {
> div.def {
&:before {
content: '';
color: var(--list-definition-icon);
position: relative;
margin-top: 0.3em;
font-size: 0.9em;
font-weight: bold;
}

> .string.m > .line {
border-left: 1rem solid rgba($red-bright, 0.06);
}
}
}
}

Expand Down
25 changes: 16 additions & 9 deletions src/Glitch/Renderer/assets/scss/_scalars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
}
}

&.def {
> .line {
color: var(--definition);
}
}

&.s {
> .line {
&:before, &:after {
Expand All @@ -55,6 +61,14 @@
opacity: 0.5;
}
}

&.def {
> .line {
&:before, &:after {
display: none;
}
}
}
}

&.m {
Expand All @@ -70,7 +84,7 @@

> .line {
margin-left: -0.1rem;
padding-left: 0.6rem;
padding-left: 0.1rem;
border-left: 1px solid rgba($gray, 0.06);
white-space: pre;

Expand All @@ -89,18 +103,11 @@
}

&.def {
display: block;

&:before, &:after {
display: none;
}

> .length {
display: none !important;
content: '$$$';
}

> .line {
color: var(--definition);
padding-left: 0.1rem;
}
}
Expand Down

0 comments on commit 097d218

Please sign in to comment.