Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,8 @@ vite.config.*.timestamp*
vitest.config.*.timestamp*
.cursor/rules/nx-rules.mdc
.github/instructions/nx.instructions.md
/packages/ui-mobile-base/windows/widgets-cpp/NativeSc.B6D1F2A0
/packages/ui-mobile-base/windows/widgets-cpp/obj
/packages/ui-mobile-base/windows/widgets-cpp/x64/Debug
/packages/ui-mobile-base/windows/widgets-cpp/x64/Release
/packages/ui-mobile-base/windows/widgets-cpp/ARM64
Binary file added apps/toolbox/fonts/Twemoji.Mozilla.ttf
Binary file not shown.
1 change: 1 addition & 0 deletions apps/toolbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@nativescript/visionos": "~9.0.0",
"@nativescript/vite": "file:../../dist/packages/vite",
"@nativescript/webpack": "file:../../dist/packages/webpack5",
"@nativescript/windows": "0.1.0-beta.1",
"typescript": "~5.8.0"
}
}
59 changes: 59 additions & 0 deletions apps/toolbox/src/_app-platform.windows.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/* Import theme rules for Windows and include additional core rules so Windows gets the same
look as other platforms without modifying the NativeScript runtime. */
@import '../../../node_modules/nativescript-theme-core/css/core.light.windows.css';

/* Only include the Windows-specific theme file here. Importing iOS/Android theme
files in the Windows platform CSS can introduce conflicting rules and
unexpected colors; platform-specific CSS should be kept separate. */

/* Fallbacks / platform-specific tweaks for Windows host environments */

/* Ensure pages default to white background like the theme */
.page, Page {
background-color: #fff;
}

/* Visibility helper used across the theme */
.invisible {
visibility: collapse;
}

/* h-full is referenced in markup but was never defined; map it to full height so a
ScrollView inside an auto-sized StackLayout gets a bounded viewport and can scroll. */
.h-full {
height: 100%;
}

/* Simple shadow/gradient fallbacks — some Windows hosts may not fully support composition */
.shadow {
box-shadow: 0 2 6 rgba(0,0,0,0.2);
border-radius: 4;
}
.gradient {
background: linear-gradient(to bottom, #f12711, #f5af19);
}

/* Make list items readable on Windows hosts */
.list-group .list-group-item {
padding: 16;
color: #212121;
}

/* TabView / SegmentedBar defaults */
.tab-view {
selected-color: #30bcff;
tabs-background-color: #fff;
}
.tab-view .tab-view-item {
background-color: #fff;
}

/* Ensure ScrollView / ListView backgrounds don't hide content */
ScrollView, ListView, Repeater {
background-color: transparent;
}

/* Make sure controls have a sensible default enabled/disabled appearance */
Button[isEnabled=false], TextField[isEnabled=false], TextView[isEnabled=false] {
opacity: 0.6;
}
6 changes: 3 additions & 3 deletions apps/toolbox/src/pages/a11y.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class AccessibilityModel extends Observable {
accessibilityLiveRegions = AccessibilityLiveRegion;
accessibilityRole = AccessibilityRole;
accessibilityState = AccessibilityState;
largeImageSrc = 'https://i.picsum.photos/id/669/5000/5000.jpg?hmac=VlpchW0ODhflKm0SKOYQrc8qysLWbqKmDS1MGT9apAc';
largeImageSrc = 'https://picsum.photos/seed/VlpchW0ODhflKm0SKOYQrc8qysLWbqKmDS1MGT9apAc/5000/5000';

constructor() {
super();
Expand All @@ -30,8 +30,8 @@ export class AccessibilityModel extends Observable {

// prettier-ignore
this.notifyPropertyChange('largeImageSrc', checked ?
'https://i.picsum.photos/id/669/5000/5000.jpg?hmac=VlpchW0ODhflKm0SKOYQrc8qysLWbqKmDS1MGT9apAc' :
'https://i.picsum.photos/id/684/5000/5000.jpg?hmac=loiXO_OQ-y86XY_hc7p3qJdY39fSd9CuDM0iA_--P4Q');
'https://picsum.photos/seed/VlpchW0ODhflKm0SKOYQrc8qysLWbqKmDS1MGT9apAc/5000/5000' :
'https://picsum.photos/seed/loiXO_OQ-y86XY_hc7p3qJdY39fSd9CuDM0iA_--P4Q/5000/5000');
}

openModal() {
Expand Down
2 changes: 1 addition & 1 deletion apps/toolbox/src/pages/box-shadow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,4 @@ export class BoxShadowModel extends Observable {
});
}
}
}
}
3 changes: 1 addition & 2 deletions apps/toolbox/src/pages/box-shadow.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" class="page">
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" navigatedTo="navigatedTo" class="page">
<Page.actionBar>
<ActionBar title="Box Shadow" icon="" class="action-bar">
</ActionBar>
</Page.actionBar>

<GridLayout rows="*, auto, *" class="box-shadow-demo">
<StackLayout backgroundColor="#ededed" row="0" id="boxShadowDemo">
<!-- layouts -->
Expand Down
2 changes: 1 addition & 1 deletion apps/toolbox/src/pages/css-playground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class CssPlaygroundModel extends Observable {

applyCSS(args) {
this.resetCSS();
addTaggedAdditionalCSS(`#play { ${this.currentCSS}`, CSSTag);
addTaggedAdditionalCSS(`#play { ${this.currentCSS} }`, CSSTag);
playLabel._onCssStateChange();
playLabel.requestLayout();
}
Expand Down
2 changes: 1 addition & 1 deletion apps/toolbox/src/pages/list-page-model-sticky.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1430,4 +1430,4 @@ export class ListPageModelSticky extends Observable {
.filter((group) => group.items.length > 0)
);
}
}
}
2 changes: 1 addition & 1 deletion apps/toolbox/src/pages/list-page-sticky.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ListView.itemTemplates>
<template key="main">
<GridLayout columns="auto,auto,*" padding="14 12 14 12" margin="2 6 2 6" borderRadius="10" backgroundColor="#fff" boxShadow="0px 1px 2px rgba(0,0,0,0.2)">
<Label color="black" text="{{ flag }}" marginLeft="4"></Label>
<Label color="black" text="{{ flag }}" marginLeft="4" fontFamily="ms-appx:///app/fonts/Twemoji.Mozilla.ttf#Twemoji Mozilla"></Label>
<Label col="1" text="{{ name }}" marginLeft="6" color="black"></Label>
<Label col="2" text="{{ code }}" marginLeft="4" color="#999"></Label>
</GridLayout>
Expand Down
6 changes: 6 additions & 0 deletions apps/toolbox/src/pages/list-page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<Label text="{{ iconText }}" class="icon-label"/>
</StackLayout>
</android>
<windows>
<Label text="{{ iconText }}" class="icon-around icon-label"/>
</windows>
<StackLayout class="va-middle">
<Label text="{{ name }}" class="component-label"></Label>
</StackLayout>
Expand All @@ -47,6 +50,9 @@
<Label text="{{ iconText }}" class="icon-label"/>
</StackLayout>
</android>
<windows>
<Label text="{{ iconText }}" class="icon-around icon-label"/>
</windows>
<StackLayout class="va-middle">
<Label text="{{ name }}" class="component-label"></Label>
</StackLayout>
Expand Down
4 changes: 3 additions & 1 deletion apps/toolbox/src/split-view/split-view-primary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ let page: Page;

export function navigatingTo(args: EventData) {
page = <Page>args.object;
page.bindingContext = new SplitViewPrimaryModel();
const model = new SplitViewPrimaryModel();
page.bindingContext = model;
try { console.log('[Primary] navigatingTo, items.length=', model.items?.length); } catch (_e) {}
}

export class SplitViewPrimaryModel extends Observable {
Expand Down
3 changes: 2 additions & 1 deletion apps/toolbox/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"paths": {
"~/*": ["src/*"]
}
}
},
"exclude": ["node_modules", "tmp", "platforms", "__tests__", "vite.config.ts"]
}
6 changes: 6 additions & 0 deletions apps/toolbox/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const webpack = require("@nativescript/webpack");
const path = require("path");

module.exports = (env) => {
webpack.init(env);
Expand All @@ -11,6 +12,11 @@ module.exports = (env) => {

return args
})

// Stub Windows-unsupported packages
if (env.windows) {
config.resolve.alias.set('@nativescript/imagepicker', path.resolve(__dirname, 'src/stubs/imagepicker.js'));
}
})

return webpack.resolveConfig();
Expand Down
1 change: 1 addition & 0 deletions apps/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@nativescript/ios": "~9.0.0",
"@nativescript/visionos": "~9.0.0",
"@nativescript/webpack": "file:../../dist/packages/webpack5",
"@nativescript/windows": "0.1.0-beta.1",
"typescript": "~5.8.0"
},
"gitHead": "8ab7726d1ee9991706069c1359c552e67ee0d1a4",
Expand Down
64 changes: 64 additions & 0 deletions apps/ui/src/animation/effect-summary-details-page.windows.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { getViewById, View, Page, Animation, Screen, TextView } from '@nativescript/core';

let toggle = false;

export function pageLoaded(args) {
const page = args.object;
const screenHeight = Screen.mainScreen.heightDIPs;
const screenYCenter = screenHeight / 2;
page.bindingContext = {
screenHeight,
screenYCenter,
detailsHeight: 96,
summary: 'Space! 🌌',
ipsum: `Houston, Tranquillity Base here. The Eagle has landed.

For those who have seen the Earth from space, and for the hundreds and perhaps thousands more who will, the experience most certainly changes your perspective. The things that we share in our world are far more valuable than those which divide us.

As we got further and further away, it [the Earth] diminished in size. Finally it shrank to the size of a marble, the most beautiful you can imagine. That beautiful, warm, living object looked so fragile, so delicate, that if you touched it with a finger it would crumble and fall apart. Seeing this has to change a man.

What was most significant about the lunar voyage was not that man set foot on the Moon but that they set eye on the earth.

Spaceflights cannot be stopped. This is not the work of any one man or even a group of men. It is a historical process which mankind is carrying out in accordance with the natural laws of human development.

NASA is not about the 'Adventure of Human Space Exploration'…We won't be doing it just to get out there in space – we'll be doing it because the things we learn out there will be making life better for a lot of people who won't be able to go.

Science has not yet mastered prophecy. We predict too much for the next year and yet far too little for the next 10.

Science cuts two ways, of course; its products can be used for both good and evil. But there's no turning back from science. The early warnings about technological dangers also come from science.

Here men from the planet Earth first set foot upon the Moon. July 1969 AD. We came in peace for all mankind.

When I orbited the Earth in a spaceship, I saw for the first time how beautiful our planet is. Mankind, let us preserve and increase this beauty, and not destroy it!

http://spaceipsum.com`,
};
}

export function theFinalFrontier(args) {
const clicked = args.object as View;
const page: Page = clicked.page;
const details = getViewById(page, 'details') as TextView;
const ctx = page.bindingContext;
const detailHeaderHeight: number = ctx.detailsHeight;
const textViewHeight: number = ctx.screenHeight - detailHeaderHeight;
const transitions = [
{
target: clicked,
height: toggle ? '100%' : detailHeaderHeight,
duration: 200,
curve: 'ease',
},
{
target: details,
opacity: toggle ? 0 : 1,
height: textViewHeight,
translate: { x: 0, y: toggle ? 50 : 0 },
duration: 200,
curve: 'easeIn',
},
];
const animationSet = new Animation(transitions, false);
animationSet.play();
toggle = !toggle;
}
3 changes: 3 additions & 0 deletions packages/core/animation-frame/animation-native.windows.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function getTimeInFrameBase(): number {
return Date.now();
}
108 changes: 108 additions & 0 deletions packages/core/application-settings/index.windows.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import * as Common from './application-settings-common';

export function hasKey(key: string): boolean | undefined {
if (!Common.checkKey(key)) {
return;
}

const localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
return localSettings.Values.HasKey(key);
}

export function getBoolean(key: string, defaultValue?: boolean): boolean | undefined {
if (!Common.checkKey(key)) {
return undefined;
}
if (hasKey(key)) {
const localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
return localSettings.Values[key] as never;
}

return defaultValue;
}

export function getString(key: string, defaultValue?: string): string | undefined {
if (!Common.checkKey(key)) {
return;
}
if (hasKey(key)) {
const localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
return localSettings.Values[key] as never;
}

return defaultValue;
}

export function getNumber(key: string, defaultValue?: number): number | undefined {
if (!Common.checkKey(key)) {
return;
}
if (hasKey(key)) {
const localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
return localSettings.Values[key] as never;
}

return defaultValue;
}

export function setBoolean(key: string, value: boolean): void {
if (!Common.checkKey(key)) {
return;
}
if (!Common.ensureValidValue(value, 'boolean')) {
return;
}
const localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
localSettings.Values[key] = value;
}

export function setString(key: string, value: string): void {
if (!Common.checkKey(key)) {
return;
}
if (!Common.ensureValidValue(value, 'string')) {
return;
}
const localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
localSettings.Values[key] = value;
}

export function setNumber(key: string, value: number): void {
if (!Common.checkKey(key)) {
return;
}
if (!Common.ensureValidValue(value, 'number')) {
return;
}
const localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
localSettings.Values[key] = value;
}

export function remove(key: string): void {
if (!Common.checkKey(key)) {
return;
}
const localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
localSettings.Values.Remove(key);
}

export function clear(): void {
Windows.Storage.ApplicationData.Current.LocalSettings.Values.Clear();
}

export function flush(): boolean {
// no-op since Windows.Storage.ApplicationData is automatically flushed by the system
return true;
}

export function getAllKeys(): Array<string> {
const Values = Windows.Storage.ApplicationData.Current.LocalSettings.Values;
const first = Values.First();
const ret: string[] = [];
while (first && first.HasCurrent) {
ret.push(first.Current.Key);
first.MoveNext();
}

return ret;
}
Loading
Loading