Skip to content

Commit

Permalink
Move model related runtime files to shared/model
Browse files Browse the repository at this point in the history
Change-Id: I2f9ee355a131f68688c66b69ecd8d54f95d5b4cb
GitOrigin-RevId: 7ceb5024fa6e7584d2a6ad21f9b8ea6ea2208b57
  • Loading branch information
jaslong authored and Copybara committed Jun 27, 2024
1 parent 1b3dea1 commit 05a387c
Show file tree
Hide file tree
Showing 462 changed files with 3,083 additions and 2,873 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ module.exports = {
"platform/wab/create-react-app-new/",
"platform/wab/deps/",
"platform/wab/public/static/",
"platform/wab/src/wab/classes.ts",
"platform/wab/src/wab/classes-metas.ts",
"platform/wab/src/wab/client/plasmic/",
"platform/wab/src/wab/client/sandboxes/",
"platform/wab/src/wab/shared/model/classes.ts",
"platform/wab/src/wab/shared/model/classes-metas.ts",
],
rules: {
curly: "error",
Expand Down
6 changes: 3 additions & 3 deletions platform/wab/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ src/wab/gen/
public/static/img/*.svg
public/static/img/icons/*.svg
build/
src/wab/classes.ts
src/wab/classes-metas.ts
src/wab/shared/model/classes.ts
src/wab/shared/model/classes-metas.ts
server/.cachedev-build/
**/dev-build
src/wab/styles/_tokens.sass
Expand Down Expand Up @@ -79,4 +79,4 @@ platform/sub/typedoc/
**/bower_components/
**/node_modules/
**/storybook-static/
**/.nx/
**/.nx/
4 changes: 2 additions & 2 deletions platform/wab/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
/public/static/img/icons/*.svg
/public/static/js/loader-hydrate.*
/build/
/src/wab/classes.ts
/src/wab/classes-metas.ts
/src/wab/shared/model/classes.ts
/src/wab/shared/model/classes-metas.ts
/src/wab/client/plasmic-deployed.json
/server/.cachedev-build/
dev-build
Expand Down
2 changes: 1 addition & 1 deletion platform/wab/.storybook/StudioCtxDecorator.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Site } from "@/wab/classes";
import { Api } from "@/wab/client/api";
import { AppCtx } from "@/wab/client/app-ctx";
import { Clipboard } from "@/wab/client/clipboard";
Expand All @@ -9,6 +8,7 @@ import {
} from "@/wab/client/studio-ctx/StudioCtx";
import { DEVFLAGS } from "@/wab/devflags";
import { FastBundler } from "@/wab/shared/bundler";
import { Site } from "@/wab/shared/model/classes";
import { PkgInfo, SiteInfo } from "@/wab/shared/SharedApi";
import { mkScreenVariantGroup } from "@/wab/shared/SpecialVariants";
import { mkBaseVariant } from "@/wab/shared/Variants";
Expand Down
8 changes: 4 additions & 4 deletions platform/wab/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SUBDIRS := $(wildcard src/wab/shared/copilot/internal/.)
all: \
src/wab/gen/modelPegParser.js \
src/wab/gen/funcTplParser.js \
src/wab/classes.ts \
src/wab/shared/model/classes.ts \
src/wab \
src/wab/gen/cssPegParser.js \
src/wab/gen/GridStyleParser.js \
Expand All @@ -19,9 +19,9 @@ all: \
$(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@
src/wab/classes.ts: src/wab/gen/modelPegParser.js src/wab/model/model-schema.ts tools/gen-models.ts src/wab/model/model-generator.ts
src/wab/shared/model/classes.ts: src/wab/gen/modelPegParser.js src/wab/shared/model/model-schema.ts tools/gen-models.ts src/wab/shared/model/model-generator.ts
yarn gen:models
src/wab/classes-metas.ts: src/wab/gen/modelPegParser.js src/wab/model/model-schema.ts tools/gen-models.ts src/wab/model/model-generator.ts
src/wab/shared/model/classes-metas.ts: src/wab/gen/modelPegParser.js src/wab/shared/model/model-schema.ts tools/gen-models.ts src/wab/shared/model/model-generator.ts
yarn gen:models
src/wab/styles/_tokens.sass: src/wab/styles/plasmic-tokens.theo.json
yarn run theo src/wab/styles/plasmic-tokens.theo.json --transform web --format sass --dest src/wab/styles
Expand Down Expand Up @@ -64,4 +64,4 @@ src/wab/gen/static/styles/prismjs-css.txt: node_modules/prismjs/themes/prism.min
# Tolerate missing ../.gitignore since a wab backend docker build does not include parent dirs
.dockerignore: .gitignore $(wildcard ../.gitignore) tools/bootstrap/gen-dockerignore.js
node tools/bootstrap/gen-dockerignore.js > $@
.PHONY: all $(SUBDIRS)
.PHONY: all $(SUBDIRS)
2 changes: 1 addition & 1 deletion platform/wab/cypress/support/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/
import * as _ from "lodash";
import * as platform from "platform";
import { HostLessPackageInfo, State } from "../../src/wab/classes";
import { ACTIONS_META } from "../../src/wab/client/state-management/interactions-meta";
import { StudioCtx } from "../../src/wab/client/studio-ctx/StudioCtx";
import { ViewCtx } from "../../src/wab/client/studio-ctx/view-ctx";
Expand All @@ -27,6 +26,7 @@ import {
ApiUpdateDataSourceRequest,
CreateSiteRequest,
} from "../../src/wab/shared/ApiSchema";
import { HostLessPackageInfo, State } from "../../src/wab/shared/model/classes";
import { StateAccessType, StateVariableType } from "../../src/wab/states";
import bundles from "../bundles";

Expand Down
2 changes: 1 addition & 1 deletion platform/wab/src/RestBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// This file is owned by you, feel free to edit as you see fit.
import { AuthData } from "@/AuthForm";
import KeyValueRow from "@/KeyValueRow";
import { RestQuery } from "@/wab/classes";
import { RestQuery } from "@/wab/shared/model/classes";
import * as React from "react";
import { useMemo, useState } from "react";
import {
Expand Down
2 changes: 1 addition & 1 deletion platform/wab/src/SimplePathBuilder.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This is a skeleton starter React component generated by Plasmic.
// This file is owned by you, feel free to edit as you see fit.
import SimplePathColumn from "@/SimplePathColumn";
import { Var } from "@/wab/classes";
import { Var } from "@/wab/shared/model/classes";
import L from "lodash";
import * as React from "react";
import { useState } from "react";
Expand Down
6 changes: 3 additions & 3 deletions platform/wab/src/wab/__tests__/TplMgr-spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ComponentType, mkComponent } from "@/wab/components";
import { ScreenSizeSpec } from "@/wab/shared/Css";
import {
Arg,
ensureKnownTplTag,
TplComponent,
VariantGroup,
VariantsRef,
} from "@/wab/classes";
import { ComponentType, mkComponent } from "@/wab/components";
import { ScreenSizeSpec } from "@/wab/shared/Css";
} from "@/wab/shared/model/classes";
import { ensureBaseVariant, TplMgr, uniquePagePath } from "@/wab/shared/TplMgr";
import { mkVariantSetting } from "@/wab/shared/Variants";
import { createSite } from "@/wab/sites";
Expand Down
7 changes: 5 additions & 2 deletions platform/wab/src/wab/__tests__/bundler-spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { ensureKnownComponent, ensureKnownTplComponent } from "@/wab/classes";
import { Comparator } from "@/wab/cmp";
import { jsonClone, mkUuid } from "@/wab/common";
import { ComponentType, mkComponent } from "@/wab/components";
import { jsonLit } from "@/wab/exprs";
import { mkParam } from "@/wab/lang";
import * as bundler from "@/wab/shared/bundler";
import { typeFactory } from "@/wab/shared/core/model-util";
import {
ensureKnownComponent,
ensureKnownTplComponent,
} from "@/wab/shared/model/classes";
import { typeFactory } from "@/wab/shared/model/model-util";
import { TEST_GLOBAL_VARIANT } from "@/wab/test/tpls";
import { mkTplComponentX, mkTplTagX } from "@/wab/tpls";
import L from "lodash";
Expand Down
8 changes: 4 additions & 4 deletions platform/wab/src/wab/__tests__/components-spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { tuple } from "@/wab/common";
import { ComponentType, extractComponent } from "@/wab/components";
import { tryExtractJson } from "@/wab/exprs";
import {
isKnownVariantsRef,
RuleSet,
TplTag,
Variant,
VariantSetting,
} from "@/wab/classes";
import { tuple } from "@/wab/common";
import { ComponentType, extractComponent } from "@/wab/components";
import { tryExtractJson } from "@/wab/exprs";
} from "@/wab/shared/model/classes";
import { RuleSetHelpers } from "@/wab/shared/RuleSetHelpers";
import { assertSiteInvariants } from "@/wab/shared/site-invariants";
import { TplMgr } from "@/wab/shared/TplMgr";
Expand Down
10 changes: 5 additions & 5 deletions platform/wab/src/wab/__tests__/focus-heuristics-spec.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { TplComponent, TplNode } from "@/wab/classes";
import { FocusHeuristics } from "@/wab/client/focus-heuristics";
import { ComponentCtx } from "@/wab/client/studio-ctx/component-ctx";
import { ensure, ensureInstance, maybe, tuple } from "@/wab/common";
import * as Components from "@/wab/components";
import { ComponentType } from "@/wab/components";
import * as Lang from "@/wab/lang";
import { typeFactory } from "@/wab/shared/core/model-util";
import { ValState } from "@/wab/shared/eval/val-state";
import { TplMgr } from "@/wab/shared/TplMgr";
import { ValState } from "@/wab/shared/eval/val-state";
import { TplComponent, TplNode } from "@/wab/shared/model/classes";
import { typeFactory } from "@/wab/shared/model/model-util";
import { createSite } from "@/wab/sites";
import {
TEST_GLOBAL_VARIANT,
buildValTree,
mkTplTestText,
renderStateForTests,
TEST_GLOBAL_VARIANT,
} from "@/wab/test/tpls";
import * as Tpls from "@/wab/tpls";
import { mkTplComponentX } from "@/wab/tpls";
import * as ValNodes from "@/wab/val-nodes";
import {
slotContentValNode,
ValComponent,
ValNode,
ValSlot,
slotContentValNode,
} from "@/wab/val-nodes";

describe("FocusHeuristics", function () {
Expand Down
13 changes: 9 additions & 4 deletions platform/wab/src/wab/__tests__/gen-element-repr-v2-spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import { NodeMarker, RawText, RenderExpr, StyleMarker } from "@/wab/classes";
import { ensureType } from "@/wab/common";
import { codeLit } from "@/wab/exprs";
import { PlasmicElement } from "@/wab/shared/element-repr/element-repr-v2";
import { tplToPlasmicElements } from "@/wab/shared/element-repr/gen-element-repr-v2";
import { ensureBaseVariant } from "@/wab/shared/TplMgr";
import { ensureBaseVariantSetting } from "@/wab/shared/VariantTplMgr";
import { PlasmicElement } from "@/wab/shared/element-repr/element-repr-v2";
import { tplToPlasmicElements } from "@/wab/shared/element-repr/gen-element-repr-v2";
import {
NodeMarker,
RawText,
RenderExpr,
StyleMarker,
} from "@/wab/shared/model/classes";
import { mkRuleSet } from "@/wab/styles";
import { componentLib } from "@/wab/test/eval";
import {
TplTagType,
mkTplComponent,
mkTplInlinedText,
mkTplTagX,
TplTagType,
} from "@/wab/tpls";

describe("gen-element-types", () => {
Expand Down
4 changes: 2 additions & 2 deletions platform/wab/src/wab/__tests__/model-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ensure, tuple } from "@/wab/common";
import { clean, parse, transform } from "@/wab/model/model-generator";
import { Class, Field, Type, withoutUids } from "@/wab/model/model-meta";
import { clean, parse, transform } from "@/wab/shared/model/model-generator";
import { Class, Field, Type, withoutUids } from "@/wab/shared/model/model-meta";
import L from "lodash";

function trimIndent(x: string) {
Expand Down
6 changes: 3 additions & 3 deletions platform/wab/src/wab/__tests__/observable-model-spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ensure, hackyCast } from "@/wab/common";
import { removeFromArray } from "@/wab/commons/collections";
import { parse, transform } from "@/wab/model/model-generator";
import { MetaRuntime, ObjInstBase } from "@/wab/model/model-meta";
import {
ChangeRecorder,
ModelChange,
observeModel,
} from "@/wab/observable-model";
import { InstUtil } from "@/wab/shared/core/InstUtil";
import { InstUtil } from "@/wab/shared/model/InstUtil";
import { parse, transform } from "@/wab/shared/model/model-generator";
import { MetaRuntime, ObjInstBase } from "@/wab/shared/model/model-meta";
import L from "lodash";
import { Lambda } from "mobx";

Expand Down
6 changes: 5 additions & 1 deletion platform/wab/src/wab/__tests__/project-deps.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { ProjectDependency, Site, SiteParams } from "@/wab/classes";
import { walkDependencyTree } from "@/wab/project-deps";
import { mkScreenVariantGroup } from "@/wab/shared/SpecialVariants";
import { mkBaseVariant } from "@/wab/shared/Variants";
import {
ProjectDependency,
Site,
SiteParams,
} from "@/wab/shared/model/classes";
import { createDefaultTheme } from "@/wab/sites";

describe("walkDependencyTree", () => {
Expand Down
20 changes: 10 additions & 10 deletions platform/wab/src/wab/__tests__/site-semver-spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import { mkShortId } from "@/wab/common";
import { ComponentType, mkComponent } from "@/wab/components";
import { ParamExportType, mkParam } from "@/wab/lang";
import { $$$ } from "@/wab/shared/TplQuery";
import { ensureBaseVariantSetting } from "@/wab/shared/VariantTplMgr";
import { VariantGroupType, mkBaseVariant } from "@/wab/shared/Variants";
import {
ComponentVariantGroup,
CustomCode,
Expand All @@ -10,20 +16,14 @@ import {
StyleToken,
TplTag,
Variant,
} from "@/wab/classes";
import { mkShortId } from "@/wab/common";
import { ComponentType, mkComponent } from "@/wab/components";
import { mkParam, ParamExportType } from "@/wab/lang";
import { typeFactory } from "@/wab/shared/core/model-util";
} from "@/wab/shared/model/classes";
import { typeFactory } from "@/wab/shared/model/model-util";
import {
calculateSemVer,
ChangeLogEntry,
calculateSemVer,
compareSites,
} from "@/wab/shared/site-diffs";
import { $$$ } from "@/wab/shared/TplQuery";
import { mkBaseVariant, VariantGroupType } from "@/wab/shared/Variants";
import { ensureBaseVariantSetting } from "@/wab/shared/VariantTplMgr";
import { createSite, UNINITIALIZED_VALUE } from "@/wab/sites";
import { UNINITIALIZED_VALUE, createSite } from "@/wab/sites";
import { mkTplTagX } from "@/wab/tpls";
import L from "lodash";

Expand Down
4 changes: 2 additions & 2 deletions platform/wab/src/wab/__tests__/tpls-spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TplNode } from "@/wab/classes";
import * as Components from "@/wab/components";
import { ComponentType } from "@/wab/components";
import { withoutUids } from "@/wab/model/model-meta";
import { TplNode } from "@/wab/shared/model/classes";
import { withoutUids } from "@/wab/shared/model/model-meta";
import * as STpls from "@/wab/test/tpls";
import * as Tpls from "@/wab/tpls";

Expand Down
6 changes: 5 additions & 1 deletion platform/wab/src/wab/__tests__/val-nodes-spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { ensureKnownTplTag, TplComponent, TplNode } from "@/wab/classes";
import { ensure, ensureInstance } from "@/wab/common";
import { SQ } from "@/wab/selection";
import { ValState } from "@/wab/shared/eval/val-state";
import {
ensureKnownTplTag,
TplComponent,
TplNode,
} from "@/wab/shared/model/classes";
import { TplMgr } from "@/wab/shared/TplMgr";
import { getBaseVariant } from "@/wab/shared/Variants";
import { createSite } from "@/wab/sites";
Expand Down
12 changes: 6 additions & 6 deletions platform/wab/src/wab/__tests__/variant-sort-spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { Variant } from "@/wab/classes";
import { ComponentType } from "@/wab/components";
import { TplMgr } from "@/wab/shared/TplMgr";
import { $$$ } from "@/wab/shared/TplQuery";
import {
makeVariantComboSorter,
sortedVariantCombos,
} from "@/wab/shared/variant-sort";
import {
VariantCombo,
getBaseVariant,
isPrivateStyleVariant,
isStyleVariant,
VariantCombo,
} from "@/wab/shared/Variants";
import { Variant } from "@/wab/shared/model/classes";
import {
makeVariantComboSorter,
sortedVariantCombos,
} from "@/wab/shared/variant-sort";
import { createSite } from "@/wab/sites";
import { mkTplTagX } from "@/wab/tpls";
import L from "lodash";
Expand Down
Loading

0 comments on commit 05a387c

Please sign in to comment.