@gjsify/storybook-nativescript 0.11.0
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.
- package/lib/esm/_virtual/_rolldown/runtime.js +1 -0
- package/lib/esm/app.js +1 -0
- package/lib/esm/controls.js +1 -0
- package/lib/esm/devtools.js +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/registry.js +1 -0
- package/lib/esm/story-view.js +1 -0
- package/lib/esm/types.js +1 -0
- package/lib/types/app.d.ts +58 -0
- package/lib/types/controls.d.ts +8 -0
- package/lib/types/devtools.d.ts +24 -0
- package/lib/types/index.d.ts +8 -0
- package/lib/types/index.spec.d.ts +2 -0
- package/lib/types/registry.d.ts +1 -0
- package/lib/types/story-view.d.ts +35 -0
- package/lib/types/types.d.ts +24 -0
- package/package.json +85 -0
- package/src/theme/storybook.css +197 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0});export{__name};
|
package/lib/esm/app.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{createControlRow as e}from"./controls.js";import{StorybookController as t}from"@gjsify/storybook-core";import{AdwHeaderBar as n,AdwImageButton as r,AdwNavigationSplitView as i,AdwOverlaySplitView as a,AdwPreferencesGroup as o,AdwToolbarView as s,AdwWindowTitle as c}from"@gjsify/adwaita-nativescript";import{goPreviousSymbolic as l,sidebarShowRightSymbolic as u}from"@gjsify/adwaita-icons/actions";import{Label as d,ScrollView as f,StackLayout as p}from"@nativescript/core";var StorybookNativeApp=class{_controller=new t(this,e=>this._buildControls(e));_options;root;_listColumn;_previewSlot;_previewTitle;_controlsGroup;_controlsSplit;_rowByTitle=new Map;constructor(e){this._options=e,this.root=new i,this.root.collapsed=!0,this.root.className=`sb-window`}mount(){return this._buildUI(),this._controller.mount(this._options.stories,this._options.openFirst!==!1),this.root}get activeStory(){return this._controller.activeStory}listStories(){return this._controller.listStories()}openStoryByTitle(e){return this._controller.openStoryByTitle(e)}getCurrentStory(){return this._controller.getCurrentStory()}setActiveArg(e,t){return this._controller.setActiveArg(e,t)}get controller(){return this._controller}renderSidebar(e,t){this._listColumn.removeChildren(),this._rowByTitle.clear();for(let{category:n,stories:r}of e){let e=new d;e.text=n,e.className=`sb-category`,this._listColumn.addChild(e);for(let{instance:e,name:n}of r){let r=new p;r.orientation=`vertical`,r.className=`sb-story-row`;let i=new d;i.text=n,i.className=`sb-story-row-label`,r.addChild(i),r.addEventListener(`tap`,()=>{t(e),this.root.hideSidebarPane()}),this._listColumn.addChild(r),this._rowByTitle.set(e.meta.title,r)}}}markSelected(e){for(let[t,n]of this._rowByTitle)n.className=t===e?`sb-story-row sb-story-row-selected`:`sb-story-row`}setPreviewTitle(e){this._previewTitle.title=e}showPreview(e){this._previewSlot.removeChildren(),this._previewSlot.addChild(e.view)}renderControls(e){this._controlsGroup.listbox.removeChildren();for(let t of e)this._controlsGroup.addRow(t.view)}_buildControls(t){let n=[],r=t.meta.controls;if(Array.isArray(r))for(let i of r){if(!i?.name||!i?.type){console.warn(`Invalid control configuration:`,i);continue}let r=e(t,i);r&&n.push(r)}return n}_buildUI(){let e=new s;e.className=`${e.className} sb-sidebar-pane`.trim();let t=new n;t.className=`${t.className} sb-sidebar-header`.trim();let i=new c;i.title=this._options.title??`Stories`,t.setTitleWidget(i),e.addTopBar(t),this._listColumn=new p,this._listColumn.orientation=`vertical`,this._listColumn.className=`sb-sidebar-list`;let d=new f;d.className=`sb-sidebar-scroll`,d.content=this._listColumn,e.setContent(d),this.root.setSidebar(e);let m=new s;m.className=`${m.className} sb-content-pane`.trim();let h=new n;h.className=`${h.className} sb-detail-header`.trim();let g=new r;g.icon=l,g.className=`${g.className} sb-back-button`.trim(),g.addEventListener(`tap`,()=>this.root.showSidebarPane()),h.packStart(g),this._previewTitle=new c,this._previewTitle.title=`Preview`,h.setTitleWidget(this._previewTitle);let _=new r;_.icon=u,_.className=`${_.className} sb-controls-toggle`.trim(),_.addEventListener(`tap`,()=>{this._controlsSplit.showSidebar=!this._controlsSplit.showSidebar}),h.packEnd(_),m.addTopBar(h),this._controlsSplit=new a,this._controlsSplit.collapsed=!0,this._controlsSplit.sidebarPosition=`end`,this._controlsSplit.sidebarWidth=320,this._controlsSplit.className=`${this._controlsSplit.className} sb-controls-split`.trim(),this._previewSlot=new p,this._previewSlot.orientation=`vertical`,this._previewSlot.className=`sb-preview-pane`;let v=new f;v.className=`sb-preview-scroll`,v.content=this._previewSlot,this._controlsSplit.setContent(v),this._controlsGroup=new o,this._controlsGroup.title=`Controls`,this._controlsGroup.className=`${this._controlsGroup.className} sb-controls-group`.trim();let y=new f;y.className=`sb-controls-scroll`,y.content=this._controlsGroup,this._controlsSplit.setSidebar(y),this._controlsSplit.hideSidebarPane(),m.setContent(this._controlsSplit),this.root.setContent(m),this.root.showSidebarPane()}};function runStorybook(e){let t=new StorybookNativeApp(e);return t.mount(),t}export{StorybookNativeApp,runStorybook};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{bindControl as e}from"@gjsify/storybook-core";import{AdwComboRow as t,AdwEntryRow as n,AdwSliderRow as r,AdwSpinRow as i,AdwSwitchRow as a,NOTIFY_ACTIVE as o,NOTIFY_SELECTED as s,NOTIFY_SLIDER_VALUE as c,NOTIFY_TEXT as l,NOTIFY_VALUE as u}from"@gjsify/adwaita-nativescript";function createControlRow(t,n){return e(t,n,d)}const d={text(e){let t=new n;t.title=e;let cb=()=>{};return t.addEventListener(l,e=>cb(e.text)),{node:t,get:()=>t.text??``,set:e=>{t.text=e},onChange:e=>{cb=e}}},color(e,t){let r=new n;r.title=`${e} (hex)`,t&&(r.subtitle=t);let cb=()=>{};return r.addEventListener(l,e=>cb(e.text)),{node:r,get:()=>r.text??``,set:e=>{r.text=e},onChange:e=>{cb=e}}},boolean(e,t){let n=new a;n.title=e,t&&(n.subtitle=t);let cb=()=>{};return n.addEventListener(o,e=>cb(e.active)),{node:n,get:()=>n.active,set:e=>{n.active=e},onChange:e=>{cb=e}}},number(e){return spinRow(e)},range(e){return sliderRow(e)},select(e){let n=e.options??[],r=new t;r.title=label(e),e.description&&(r.subtitle=e.description),r.options=n.map(e=>({label:e.label,value:String(e.value)}));let cb=()=>{};return r.addEventListener(s,e=>cb(e.selected)),{node:r,get:()=>r.selectedIndex,set:e=>{r.selectedIndex=e},onChange:e=>{cb=e}}}};function spinRow(e){let t=new i;t.title=label(e),e.description&&(t.subtitle=e.description),t.min=e.min??0,t.max=e.max??100,t.step=e.step??1;let cb=()=>{};return t.addEventListener(u,e=>cb(e.value)),{node:t,get:()=>t.value,set:e=>{t.value=e},onChange:e=>{cb=e}}}function sliderRow(e){let t=new r;t.title=label(e),t.min=e.min??0,t.max=e.max??100,t.step=e.step??1;let cb=()=>{};return t.addEventListener(c,e=>cb(e.value)),{node:t,get:()=>t.value,set:e=>{t.value=e},onChange:e=>{cb=e}}}function label(e){return e.label||e.name}export{createControlRow};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{buildStorybookDevtoolsExtension as e}from"@gjsify/storybook-core";import{installDevtools as t}from"@gjsify/devtools-nativescript";const n={ListStories:[],GetCurrentStory:[],OpenStory:[`title`],SetStoryArg:[`name`,`valueJson`],GetStoryArgs:[]};function buildStorybookNsExtension(t){let r=e(t);return{methods:r.methods.map(e=>{let t=n[e.name]??[],r=e.handler;return{name:e.name,kind:e.kind,handler:e=>r(...t.map(t=>e[t]))}}),contributeStatus:r.contributeStatus}}function installStorybookDevtools(e,n={}){return t({...n,extensions:[buildStorybookNsExtension(e)]})}export{buildStorybookNsExtension,installStorybookDevtools};
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createControlRow as e}from"./controls.js";import{StorybookNativeApp as t,runStorybook as n}from"./app.js";import{buildStorybookNsExtension as r,installStorybookDevtools as i}from"./devtools.js";import{StoryView as a}from"./story-view.js";import{StoryRegistry as o}from"./registry.js";import{isNsStoryModule as s}from"./types.js";import{collectStoryModules as c}from"@gjsify/storybook-core";import{ControlType as l,argsFromControls as u}from"@gjsify/stories";export{l as ControlType,o as StoryRegistry,a as StoryView,t as StorybookNativeApp,u as argsFromControls,r as buildStorybookNsExtension,c as collectStoryModules,e as createControlRow,i as installStorybookDevtools,s as isNsStoryModule,n as runStorybook};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{StoryRegistry as e}from"@gjsify/storybook-core";export{e as StoryRegistry};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{StoryViewBase as e}from"@gjsify/storybook-core";import{AdwClamp as t,AdwPreferencesGroup as n}from"@gjsify/adwaita-nativescript";import{Label as r,StackLayout as i}from"@nativescript/core";var StoryView=class extends e{constructor(e,t=`Default`,n){super(),this.initBase(e,t,n)}get view(){return this.root}createChrome(e,t){return t?{root:t,hasStage:!1,setStageContent:()=>{},setChromeText:()=>{}}:this._installDefaultChrome()}_installDefaultChrome(){let e=new i;e.orientation=`vertical`,e.className=`sb-story-page`;let a=new t;a.className=`${a.className} sb-story-clamp`.trim();let o=new n;o.className=`${o.className} sb-story-group`.trim();let s=new i;s.orientation=`vertical`,s.className=`sb-story-group-header`;let c=new r;c.className=`sb-story-group-title`,c.textWrap=!0,s.addChild(c);let l=new r;l.className=`sb-story-group-description`,l.textWrap=!0;let u=!1,d=new i;return d.orientation=`vertical`,d.className=`story-stage`,d.horizontalAlignment=`center`,o.addRow(s),o.addRow(d),a.setChild(o),e.addChild(a),{root:e,hasStage:!0,setStageContent:e=>{d.removeChildren(),d.addChild(e)},setChromeText:(e,t)=>{c.text=e,l.text=t;let n=t.length>0;n&&!u?(s.addChild(l),u=!0):!n&&u&&(s.removeChild(l),u=!1)}}}};export{StoryView};
|
package/lib/esm/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";function isNsStoryModule(e){return typeof e==`object`&&!!e&&Array.isArray(e.stories)}export{isNsStoryModule};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { StoryArgValue } from '@gjsify/stories';
|
|
2
|
+
import { type CategoryGroup, type ControlRow, StorybookController, type StorybookView, type StorySummary } from '@gjsify/storybook-core';
|
|
3
|
+
import { AdwNavigationSplitView } from '@gjsify/adwaita-nativescript';
|
|
4
|
+
import { type View } from '@nativescript/core';
|
|
5
|
+
import type { StoryView } from './story-view.js';
|
|
6
|
+
import type { NsStoryModule } from './types.js';
|
|
7
|
+
export type { StorySummary } from '@gjsify/storybook-core';
|
|
8
|
+
/** Options that adapt the storybook to a host project. */
|
|
9
|
+
export interface StorybookNativeOptions {
|
|
10
|
+
/** Story modules to display. */
|
|
11
|
+
stories: NsStoryModule[];
|
|
12
|
+
/** Title shown in the sidebar header. */
|
|
13
|
+
title?: string;
|
|
14
|
+
/** Auto-select the first story on mount (default true). */
|
|
15
|
+
openFirst?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare class StorybookNativeApp implements StorybookView<StoryView> {
|
|
18
|
+
private _controller;
|
|
19
|
+
private _options;
|
|
20
|
+
/** The single root view the host adds to its page — a collapsed navigation
|
|
21
|
+
* split view (master story list ⇄ detail preview). */
|
|
22
|
+
readonly root: AdwNavigationSplitView;
|
|
23
|
+
private _listColumn;
|
|
24
|
+
private _previewSlot;
|
|
25
|
+
private _previewTitle;
|
|
26
|
+
private _controlsGroup;
|
|
27
|
+
/** Right controls overlay (the GTK OverlaySplitView, sidebar_position=END). */
|
|
28
|
+
private _controlsSplit;
|
|
29
|
+
private _rowByTitle;
|
|
30
|
+
constructor(options: StorybookNativeOptions);
|
|
31
|
+
/** Build the UI, instantiate stories, and select the first one. Returns the root view. */
|
|
32
|
+
mount(): View;
|
|
33
|
+
/** The currently-displayed story, or null. */
|
|
34
|
+
get activeStory(): StoryView | null;
|
|
35
|
+
/** Every story flattened to a summary. */
|
|
36
|
+
listStories(): StorySummary[];
|
|
37
|
+
/** Select + show a story by its full `Category/Name` title. */
|
|
38
|
+
openStoryByTitle(title: string): boolean;
|
|
39
|
+
/** The active story as `{ title, story, args }`, or null. */
|
|
40
|
+
getCurrentStory(): {
|
|
41
|
+
title: string;
|
|
42
|
+
story: string;
|
|
43
|
+
args: Record<string, unknown>;
|
|
44
|
+
} | null;
|
|
45
|
+
/** Set one arg on the active story — drives the same path as the controls. */
|
|
46
|
+
setActiveArg(name: string, value: StoryArgValue): boolean;
|
|
47
|
+
/** The underlying controller (e.g. to build a devtools extension over it). */
|
|
48
|
+
get controller(): StorybookController<StoryView>;
|
|
49
|
+
renderSidebar(groups: Array<CategoryGroup<StoryView>>, onSelect: (instance: StoryView) => void): void;
|
|
50
|
+
markSelected(title: string): void;
|
|
51
|
+
setPreviewTitle(title: string): void;
|
|
52
|
+
showPreview(instance: StoryView): void;
|
|
53
|
+
renderControls(rows: Array<ControlRow<unknown>>): void;
|
|
54
|
+
private _buildControls;
|
|
55
|
+
private _buildUI;
|
|
56
|
+
}
|
|
57
|
+
/** Construct, mount, and return a {@link StorybookNativeApp} root view + controller. */
|
|
58
|
+
export declare function runStorybook(options: StorybookNativeOptions): StorybookNativeApp;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StoryControl } from '@gjsify/stories';
|
|
2
|
+
import { type ControlRow as CoreControlRow } from '@gjsify/storybook-core';
|
|
3
|
+
import type { View } from '@nativescript/core';
|
|
4
|
+
import type { StoryView } from './story-view.js';
|
|
5
|
+
/** A built control: the row view plus a refresher that re-syncs it from args. */
|
|
6
|
+
export type ControlRow = CoreControlRow<View>;
|
|
7
|
+
/** Build the row for a single control, or null if it cannot be rendered. */
|
|
8
|
+
export declare function createControlRow(story: StoryView, control: StoryControl): ControlRow | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type StorybookController } from '@gjsify/storybook-core';
|
|
2
|
+
import { type InstallNsDevtoolsOptions, type NsDevtoolsAgent, type NsDevtoolsExtension } from '@gjsify/devtools-nativescript';
|
|
3
|
+
import type { StoryView } from './story-view.js';
|
|
4
|
+
/**
|
|
5
|
+
* Build the NS devtools extension over a storybook controller — the
|
|
6
|
+
* renderer-neutral storybook method set from `@gjsify/storybook-core`, adapted to
|
|
7
|
+
* the NS devtools `params`-record handler shape.
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildStorybookNsExtension(controller: StorybookController<StoryView>): NsDevtoolsExtension;
|
|
10
|
+
/**
|
|
11
|
+
* Install the in-app NativeScript devtools agent with the storybook control
|
|
12
|
+
* surface wired in. A no-op returning `null` unless `GJSIFY_DEVTOOLS` is set (or
|
|
13
|
+
* `options.enabled`), so it is safe to leave in production. Call once after
|
|
14
|
+
* `runStorybook(...)`.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { Application, Frame } from '@nativescript/core';
|
|
19
|
+
* import { runStorybook, installStorybookDevtools } from '@gjsify/storybook-nativescript';
|
|
20
|
+
* const app = runStorybook({ stories });
|
|
21
|
+
* installStorybookDevtools(app.controller, { application: Application, frame: Frame });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function installStorybookDevtools(controller: StorybookController<StoryView>, options?: Omit<InstallNsDevtoolsOptions, 'extensions'>): NsDevtoolsAgent | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { ControlType, argsFromControls, type StoryArgs, type StoryArgValue, type StoryBooleanControl, type StoryColorControl, type StoryControl, type StoryMeta, type StoryNumberControl, type StorySelectControl, type StorySelectOption, type StoryTextControl, } from '@gjsify/stories';
|
|
2
|
+
export { collectStoryModules, type StorybookController } from '@gjsify/storybook-core';
|
|
3
|
+
export { StoryView, type StoryArgsListener } from './story-view.js';
|
|
4
|
+
export { StoryRegistry } from './registry.js';
|
|
5
|
+
export { createControlRow, type ControlRow } from './controls.js';
|
|
6
|
+
export { StorybookNativeApp, runStorybook, type StorybookNativeOptions, type StorySummary, } from './app.js';
|
|
7
|
+
export { buildStorybookNsExtension, installStorybookDevtools } from './devtools.js';
|
|
8
|
+
export { isNsStoryModule, type NsStoryConstructor, type NsStoryDecorator, type NsStoryModule } from './types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StoryRegistry } from '@gjsify/storybook-core';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { StoryArgs, StoryMeta } from '@gjsify/stories';
|
|
2
|
+
import { type StoryChrome, StoryViewBase } from '@gjsify/storybook-core';
|
|
3
|
+
import { type View } from '@nativescript/core';
|
|
4
|
+
/** Notified whenever a story's args change (the controls panel re-syncs through this). */
|
|
5
|
+
export type StoryArgsListener = (args: StoryArgs) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Base class for NativeScript story views.
|
|
8
|
+
*
|
|
9
|
+
* Provides default chrome — a clamped boxed group (`AdwClamp` +
|
|
10
|
+
* `AdwPreferencesGroup`) with a title + description above a centered,
|
|
11
|
+
* dashed-framed preview "stage" — built programmatically with the
|
|
12
|
+
* `@gjsify/adwaita-nativescript` widgets + the Adwaita CSS classes. Simple
|
|
13
|
+
* stories compose their preview by calling {@link addContent}; a subclass that
|
|
14
|
+
* needs a bespoke layout passes its own root view to the constructor (then
|
|
15
|
+
* {@link addContent} is a no-op), mirroring the browser `customRoot` opt-out.
|
|
16
|
+
*/
|
|
17
|
+
export declare class StoryView extends StoryViewBase<View> {
|
|
18
|
+
/**
|
|
19
|
+
* @param meta The story's metadata (the same renderer-agnostic object
|
|
20
|
+
* its GTK / browser twins use).
|
|
21
|
+
* @param story Variant name (defaults to "Default").
|
|
22
|
+
* @param customRoot Opt out of the default chrome by supplying a root view.
|
|
23
|
+
*/
|
|
24
|
+
constructor(meta: StoryMeta, story?: string, customRoot?: View);
|
|
25
|
+
/**
|
|
26
|
+
* The real NativeScript `View` an NS `Page`/`Frame` mounts. Alias for the
|
|
27
|
+
* base's {@link root} getter — the NS counterpart of the browser's
|
|
28
|
+
* `.element` (and of the GTK base simply being a widget). NativeScript needs
|
|
29
|
+
* a concrete `View` to add to a page, so this surfaces one.
|
|
30
|
+
*/
|
|
31
|
+
get view(): View;
|
|
32
|
+
/** Build the @gjsify/adwaita-nativescript native chrome — the single renderer seam. */
|
|
33
|
+
protected createChrome(_meta: StoryMeta, customRoot?: View): StoryChrome<View>;
|
|
34
|
+
private _installDefaultChrome;
|
|
35
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { StoryMeta } from '@gjsify/stories';
|
|
2
|
+
import type { StoryModuleLike } from '@gjsify/storybook-core';
|
|
3
|
+
import type { StoryView } from './story-view.js';
|
|
4
|
+
/** Constructor contract for a NS story class: zero-arg `new`, static metadata. */
|
|
5
|
+
export interface NsStoryConstructor {
|
|
6
|
+
new (): StoryView;
|
|
7
|
+
getMetadata(): StoryMeta;
|
|
8
|
+
}
|
|
9
|
+
/** Wraps a story's content-build step (e.g. to install a shared environment). */
|
|
10
|
+
export type NsStoryDecorator = (build: () => void, story: StoryView) => void;
|
|
11
|
+
/**
|
|
12
|
+
* A group of related NativeScript stories, optionally wrapped by module-level
|
|
13
|
+
* decorators. The NS binding of {@link StoryModuleLike} over {@link StoryView} +
|
|
14
|
+
* {@link NsStoryConstructor}.
|
|
15
|
+
*/
|
|
16
|
+
export interface NsStoryModule extends StoryModuleLike<StoryView, NsStoryConstructor> {
|
|
17
|
+
stories: NsStoryConstructor[];
|
|
18
|
+
/** Populated by {@link StoryRegistry.createStoryInstances}. */
|
|
19
|
+
instances?: StoryView[];
|
|
20
|
+
/** Decorators applied around every story's `initialize()` in this module. */
|
|
21
|
+
decorators?: NsStoryDecorator[];
|
|
22
|
+
}
|
|
23
|
+
/** Narrowing guard — `true` when `value` is a {@link NsStoryModule}. */
|
|
24
|
+
export declare function isNsStoryModule(value: unknown): value is NsStoryModule;
|
package/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gjsify/storybook-nativescript",
|
|
3
|
+
"version": "0.11.0",
|
|
4
|
+
"description": "NativeScript renderer for the @gjsify/stories contract — the NS counterpart of @gjsify/storybook (GTK) and @gjsify/adwaita-storybook (browser), built on @gjsify/adwaita-nativescript real native widgets",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "lib/esm/index.js",
|
|
7
|
+
"types": "lib/types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/types/index.d.ts",
|
|
11
|
+
"default": "./lib/esm/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./theme/storybook.css": "./src/theme/storybook.css"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"lib",
|
|
17
|
+
"src/theme/storybook.css"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"clear": "rm -rf lib tsconfig.tsbuildinfo tsconfig.types.tsbuildinfo test.gjs.mjs test.node.mjs || exit 0",
|
|
21
|
+
"check": "gjsify tsc --noEmit",
|
|
22
|
+
"build": "gjsify run build:gjsify && gjsify run build:types",
|
|
23
|
+
"build:gjsify": "gjsify build --library 'src/**/*.{ts,js}' --exclude 'src/**/*.spec.{mts,ts}' 'src/test.{mts,ts}'",
|
|
24
|
+
"build:types": "gjsify tsc",
|
|
25
|
+
"build:test": "gjsify run build:test:gjs && gjsify run build:test:node",
|
|
26
|
+
"build:test:gjs": "gjsify build src/test.mts --app gjs --outfile test.gjs.mjs",
|
|
27
|
+
"build:test:node": "gjsify build src/test.mts --app node --outfile test.node.mjs",
|
|
28
|
+
"test": "gjsify run build:gjsify && gjsify run build:test && gjsify run test:node && gjsify run test:gjs",
|
|
29
|
+
"test:gjs": "gjsify run test.gjs.mjs",
|
|
30
|
+
"test:node": "node test.node.mjs"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"storybook",
|
|
34
|
+
"stories",
|
|
35
|
+
"adwaita",
|
|
36
|
+
"nativescript",
|
|
37
|
+
"android",
|
|
38
|
+
"ios",
|
|
39
|
+
"gnome"
|
|
40
|
+
],
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@gjsify/adwaita-icons": "^0.11.0",
|
|
43
|
+
"@gjsify/adwaita-nativescript": "^0.11.0",
|
|
44
|
+
"@gjsify/devtools-nativescript": "^0.11.0",
|
|
45
|
+
"@gjsify/stories": "^0.11.0",
|
|
46
|
+
"@gjsify/storybook-core": "^0.11.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@nativescript/core": "*"
|
|
50
|
+
},
|
|
51
|
+
"peerDependenciesMeta": {
|
|
52
|
+
"@nativescript/core": {
|
|
53
|
+
"optional": true
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@gjsify/cli": "^0.11.0",
|
|
58
|
+
"@gjsify/unit": "^0.11.0",
|
|
59
|
+
"@nativescript/types": "~9.0.0",
|
|
60
|
+
"@types/node": "^25.9.2",
|
|
61
|
+
"typescript": "^6.0.3"
|
|
62
|
+
},
|
|
63
|
+
"gjsify": {
|
|
64
|
+
"runtimes": {
|
|
65
|
+
"gjs": "none",
|
|
66
|
+
"node": "none",
|
|
67
|
+
"browser": "none",
|
|
68
|
+
"nativescript": "native"
|
|
69
|
+
},
|
|
70
|
+
"nativescriptPlatforms": [
|
|
71
|
+
"android",
|
|
72
|
+
"ios"
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"license": "MIT",
|
|
76
|
+
"repository": {
|
|
77
|
+
"type": "git",
|
|
78
|
+
"url": "git+https://github.com/gjsify/gjsify.git",
|
|
79
|
+
"directory": "packages/nativescript-bridge/storybook"
|
|
80
|
+
},
|
|
81
|
+
"bugs": {
|
|
82
|
+
"url": "https://github.com/gjsify/gjsify/issues"
|
|
83
|
+
},
|
|
84
|
+
"homepage": "https://github.com/gjsify/gjsify/tree/main/packages/nativescript-bridge/storybook#readme"
|
|
85
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* storybook.css — storybook chrome for @gjsify/storybook-nativescript.
|
|
3
|
+
*
|
|
4
|
+
* Pairs with @gjsify/adwaita-nativescript's `theme/adwaita.css` (import BOTH into
|
|
5
|
+
* your app CSS). It styles only the storybook-specific chrome classes
|
|
6
|
+
* (`.sb-*` + `.story-stage`) — the rows + groups inherit the Adwaita look from
|
|
7
|
+
* the adwaita-nativescript stylesheet.
|
|
8
|
+
*
|
|
9
|
+
* NativeScript CSS subset ONLY: color / background-color / font-size /
|
|
10
|
+
* font-weight / padding / margin / width / height / border-* / border-radius /
|
|
11
|
+
* opacity. NO flexbox cascade, NO z-index, NO CSS custom properties (NS does not
|
|
12
|
+
* resolve `var()`) — the Adwaita tokens are inlined per rule, matching the
|
|
13
|
+
* adwaita-nativescript stylesheet's light palette
|
|
14
|
+
* (window bg #fafafb / fg rgba(0,0,0,.8); accent #3584e4; sidebar #ebebed).
|
|
15
|
+
*
|
|
16
|
+
* Color tokens ported from @gjsify/adwaita-web's `_variables.scss` / `_theme.scss`
|
|
17
|
+
* (mirroring refs/libadwaita/src/stylesheet/_colors.scss).
|
|
18
|
+
* Copyright (c) GNOME contributors (libadwaita). LGPLv2.1+.
|
|
19
|
+
*
|
|
20
|
+
* Toggle dark mode by adding `ns-dark` to the page/root (mirrors the
|
|
21
|
+
* adwaita-nativescript theme convention).
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/* ===== Window / panes ===== */
|
|
25
|
+
|
|
26
|
+
.sb-window {
|
|
27
|
+
background-color: #fafafb;
|
|
28
|
+
color: rgba(0, 0, 0, 0.8);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.sb-content-pane {
|
|
32
|
+
background-color: #fafafb;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* ===== Sidebar (story list) — distinct shade, mirrors GTK .navigation-sidebar ===== */
|
|
36
|
+
|
|
37
|
+
.sb-sidebar-pane {
|
|
38
|
+
background-color: #ebebed;
|
|
39
|
+
width: 240;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.sb-sidebar-header {
|
|
43
|
+
padding: 12 12 8 12;
|
|
44
|
+
background-color: #ebebed;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.sb-sidebar-scroll {
|
|
48
|
+
background-color: #ebebed;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.sb-sidebar-list {
|
|
52
|
+
padding: 4;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.sb-category {
|
|
56
|
+
font-size: 11;
|
|
57
|
+
font-weight: 700;
|
|
58
|
+
color: rgba(0, 0, 0, 0.55);
|
|
59
|
+
padding: 10 8 4 8;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.sb-story-row {
|
|
63
|
+
border-radius: 6;
|
|
64
|
+
margin: 1 4 1 4;
|
|
65
|
+
padding: 8 12 8 12;
|
|
66
|
+
background-color: transparent;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.sb-story-row-label {
|
|
70
|
+
font-size: 15;
|
|
71
|
+
color: rgba(0, 0, 0, 0.8);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.sb-story-row-selected {
|
|
75
|
+
background-color: #3584e4;
|
|
76
|
+
border-radius: 6;
|
|
77
|
+
margin: 1 4 1 4;
|
|
78
|
+
padding: 8 12 8 12;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.sb-story-row-selected .sb-story-row-label {
|
|
82
|
+
color: #ffffff;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* ===== Detail header (back + story title + controls toggle) ===== */
|
|
86
|
+
|
|
87
|
+
.sb-detail-header {
|
|
88
|
+
background-color: #fafafb;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.sb-back-button,
|
|
92
|
+
.sb-controls-toggle {
|
|
93
|
+
font-size: 18;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* ===== Detail area (preview content + right controls overlay) ===== */
|
|
97
|
+
|
|
98
|
+
.sb-controls-split,
|
|
99
|
+
.sb-preview-scroll {
|
|
100
|
+
background-color: #fafafb;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.sb-preview-pane {
|
|
104
|
+
padding: 24 12 24 12;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.sb-story-page {
|
|
108
|
+
padding: 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.sb-story-group-header {
|
|
112
|
+
padding: 4 2 4 2;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.sb-story-group-title {
|
|
116
|
+
font-size: 20;
|
|
117
|
+
font-weight: 700;
|
|
118
|
+
color: rgba(0, 0, 0, 0.8);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.sb-story-group-description {
|
|
122
|
+
font-size: 15;
|
|
123
|
+
color: rgba(0, 0, 0, 0.55);
|
|
124
|
+
margin: 2 0 0 0;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/*
|
|
128
|
+
* Centered, dashed-framed preview stage (mirrors the browser .story-stage and
|
|
129
|
+
* the native renderer's .story-stage). NS supports a dashed border style.
|
|
130
|
+
*/
|
|
131
|
+
.story-stage {
|
|
132
|
+
border-width: 1;
|
|
133
|
+
border-color: rgba(127, 127, 127, 0.28);
|
|
134
|
+
border-style: dashed;
|
|
135
|
+
border-radius: 12;
|
|
136
|
+
padding: 16;
|
|
137
|
+
margin: 8 0 0 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/* ===== Controls panel — a RIGHT overlay (sidebar_position=END) ===== */
|
|
141
|
+
/* Opaque so it covers the preview when toggled on; the left hairline + tinted
|
|
142
|
+
fill read as a distinct sidebar (the GTK OverlaySplitView controls pane). */
|
|
143
|
+
|
|
144
|
+
.sb-controls-scroll {
|
|
145
|
+
background-color: #ebebed;
|
|
146
|
+
border-left-width: 1;
|
|
147
|
+
border-left-color: rgba(0, 0, 0, 0.1);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.sb-controls-group {
|
|
151
|
+
margin: 8 12 12 12;
|
|
152
|
+
background-color: #ebebed;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* ===== Dark mode ===== */
|
|
156
|
+
|
|
157
|
+
.ns-dark.sb-window,
|
|
158
|
+
.ns-dark .sb-content-pane,
|
|
159
|
+
.ns-dark .sb-controls-split,
|
|
160
|
+
.ns-dark .sb-preview-scroll,
|
|
161
|
+
.ns-dark .sb-preview-pane,
|
|
162
|
+
.ns-dark .sb-detail-header {
|
|
163
|
+
background-color: #1d1d20;
|
|
164
|
+
color: rgba(255, 255, 255, 0.8);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.ns-dark .sb-controls-scroll,
|
|
168
|
+
.ns-dark .sb-controls-group {
|
|
169
|
+
background-color: #242428;
|
|
170
|
+
border-left-color: rgba(255, 255, 255, 0.1);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.ns-dark .sb-sidebar-pane,
|
|
174
|
+
.ns-dark .sb-sidebar-header,
|
|
175
|
+
.ns-dark .sb-sidebar-scroll {
|
|
176
|
+
background-color: #242428;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.ns-dark .sb-category {
|
|
180
|
+
color: rgba(255, 255, 255, 0.55);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.ns-dark .sb-story-row-label {
|
|
184
|
+
color: rgba(255, 255, 255, 0.8);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.ns-dark .sb-story-group-title {
|
|
188
|
+
color: rgba(255, 255, 255, 0.85);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.ns-dark .sb-story-group-description {
|
|
192
|
+
color: rgba(255, 255, 255, 0.55);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.ns-dark .story-stage {
|
|
196
|
+
border-color: rgba(160, 160, 160, 0.28);
|
|
197
|
+
}
|